initial stage
This commit is contained in:
parent
75221b489d
commit
fc5f884f4d
|
@ -40,14 +40,15 @@ default_args = {
|
|||
default_args=default_args,
|
||||
params={
|
||||
"S3_CONN_ID": "s3_conn",
|
||||
"OPENSEARCH_CONN_ID": "opensearch_default",
|
||||
"EOSC_CATALOG_BUCKET": "eosc-portal-import"
|
||||
},
|
||||
tags=["lot1"],
|
||||
)
|
||||
def import_EOSC_catalog():
|
||||
@task
|
||||
def create_indexes():
|
||||
conn = BaseHook.get_connection('opensearch_default')
|
||||
def create_indexes(**kwargs):
|
||||
conn = BaseHook.get_connection(kwargs["params"]["OPENSEARCH_CONN_ID"])
|
||||
client = OpenSearch(
|
||||
hosts=[{'host': conn.host, 'port': conn.port}],
|
||||
http_auth=(conn.login, conn.password),
|
||||
|
@ -98,7 +99,7 @@ def import_EOSC_catalog():
|
|||
|
||||
@task
|
||||
def bulk_load(files: list[(str, str)], **kwargs):
|
||||
conn = BaseHook.get_connection('opensearch_default')
|
||||
conn = BaseHook.get_connection(kwargs["params"]["OPENSEARCH_CONN_ID"])
|
||||
client = OpenSearch(
|
||||
hosts=[{'host': conn.host, 'port': conn.port}],
|
||||
http_auth=(conn.login, conn.password),
|
||||
|
@ -138,8 +139,8 @@ def import_EOSC_catalog():
|
|||
print(f"Bulk-inserted {len(succeeded)} items (streaming_bulk).")
|
||||
|
||||
@task
|
||||
def close_indexes():
|
||||
conn = BaseHook.get_connection('opensearch_default')
|
||||
def close_indexes(**kwargs):
|
||||
conn = BaseHook.get_connection(kwargs["params"]["OPENSEARCH_CONN_ID"])
|
||||
client = OpenSearch(
|
||||
hosts=[{'host': conn.host, 'port': conn.port}],
|
||||
http_auth=(conn.login, conn.password),
|
||||
|
|
|
@ -42,14 +42,15 @@ default_args = {
|
|||
default_args=default_args,
|
||||
params={
|
||||
"S3_CONN_ID": "s3_conn",
|
||||
"OPENSEARCH_CONN_ID": "opensearch_default",
|
||||
"EOSC_CATALOG_BUCKET": "eosc-portal-import"
|
||||
},
|
||||
tags=["lot1"]
|
||||
)
|
||||
def import_EOSC_graph():
|
||||
@task
|
||||
def create_indexes():
|
||||
conn = BaseHook.get_connection('opensearch_default')
|
||||
def create_indexes(**kwargs):
|
||||
conn = BaseHook.get_connection(kwargs["params"]["OPENSEARCH_CONN_ID"])
|
||||
client = OpenSearch(
|
||||
hosts=[{'host': conn.host, 'port': conn.port}],
|
||||
http_auth=(conn.login, conn.password),
|
||||
|
@ -123,7 +124,7 @@ def import_EOSC_graph():
|
|||
)
|
||||
})
|
||||
def bulk_load(files: list[(str, str)], **kwargs):
|
||||
conn = BaseHook.get_connection('opensearch_default')
|
||||
conn = BaseHook.get_connection(kwargs["params"]["OPENSEARCH_CONN_ID"])
|
||||
client = OpenSearch(
|
||||
hosts=[{'host': conn.host, 'port': conn.port}],
|
||||
http_auth=(conn.login, conn.password),
|
||||
|
@ -182,8 +183,8 @@ def import_EOSC_graph():
|
|||
print(f"Bulk-inserted {succeeded} items (streaming_bulk).")
|
||||
|
||||
@task
|
||||
def close_indexes():
|
||||
conn = BaseHook.get_connection('opensearch_default')
|
||||
def close_indexes(**kwargs):
|
||||
conn = BaseHook.get_connection(kwargs["params"]["OPENSEARCH_CONN_ID"])
|
||||
client = OpenSearch(
|
||||
hosts=[{'host': conn.host, 'port': conn.port}],
|
||||
http_auth=(conn.login, conn.password),
|
||||
|
|
Loading…
Reference in New Issue