Skip to content
Snippets Groups Projects
Commit 1d682e3d authored by Jedrzej Rybicki's avatar Jedrzej Rybicki
Browse files

cons

parent 8c1f4376
No related branches found
No related tags found
No related merge requests found
Pipeline #76832 passed
......@@ -20,5 +20,6 @@ test:
- pwd
- cp dags/* /opt/airflow/dags/
- airflow dags list
- airflow connections list
- airflow dags test firsto 2021-08-18
from airflow.models.baseoperator import BaseOperator
from airflow.models.connection import Connection
import requests
from urllib.parse import urljoin
def get_objects(server):
lst = requests.get(urljoin(server, 'api/records')).json()
return lst['hits']['hits']
server='https://b2share-testing.fz-juelich.de/'
class B2ShareOperator(BaseOperator):
......@@ -16,15 +18,15 @@ class B2ShareOperator(BaseOperator):
**kwargs) -> None:
super().__init__(**kwargs)
self.name = name
self.connection = Connection.get_connection_from_secrets(conn_id)
#self.connection = Connection.get_connection_from_secrets(conn_id)
def execute(self, context):
message = "Hello {}".format(self.name)
print(message)
print(self.connection.host)
#print(self.connection.host)
print(f"Retrieving info from {self.connection.host}")
lst = get_objects(server=self.connection.schema+self.connection.host)
#print(f"Retrieving info from {self.connection.host}")
lst = get_objects(server=server)
print(f"GOT: {lst}")
return message
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment