Skip to content

Commit

Permalink
Enable XCom pickling in Airflow (#421)
Browse files Browse the repository at this point in the history
* Enable xcom pickling

* Update duration reporting
  • Loading branch information
stacimc authored Mar 21, 2022
1 parent 22a8965 commit 0e3675c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions docker/airflow/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ENV OUTPUT_DIR=/var/workflow_output/
ENV AIRFLOW__CORE__DAGS_FOLDER=${AIRFLOW_HOME}/openverse_catalog/dags
ENV AIRFLOW__CORE__LOAD_EXAMPLES=False
ENV AIRFLOW__CORE__LOAD_DEFAULT_CONNECTIONS=False
ENV AIRFLOW__CORE__ENABLE_XCOM_PICKLING=True

# TODO: Test if moving this to .env changes anything!
ENV AIRFLOW__LOGGING__REMOTE_LOGGING=True
ENV AIRFLOW__LOGGING__REMOTE_LOG_CONN_ID=aws_default
Expand Down
1 change: 1 addition & 0 deletions openverse_catalog/dags/common/dag_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def create_provider_api_workflow(
catchup=False,
doc_md=doc_md,
tags=["provider"] + [f"provider: {media_type}" for media_type in media_types],
render_template_as_native_obj=True,
)

with dag:
Expand Down
6 changes: 1 addition & 5 deletions openverse_catalog/dags/common/loader/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ def report_completion(provider_name, media_type, duration, record_count):
In all cases the data is logged.
"""

# This happens when the task is manually set to `success` in Airflow before
# completing.
duration = "_No data_" if duration == "None" else duration

message = f"""
*Provider*: `{provider_name}`
*Media Type*: `{media_type}`
*Number of Records Upserted*: {record_count}
*Duration of data pull task*: {duration}
*Duration of data pull task*: {duration or "_No data_"}
* _Duration includes time taken to pull data of all media types._
"""
Expand Down

0 comments on commit 0e3675c

Please sign in to comment.