Skip to content

Commit d627d3a

Browse files
authored
Export dag_id in process_metrics for Global Uniqueness and DAG Params to DB Metadata (GoogleCloudPlatform#922)
* Export dag_id in process_metrics to ensure global uniqueness. Export dag_id in process_metrics in addition to run_id. The run_id is only unique within the current DAG run, so dag_id is required to maintain global uniqueness for metrics. * Export params to database as metadata too
1 parent 08ec0d4 commit d627d3a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

xlml/utils/metric.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,19 @@ def add_airflow_metadata(
624624
metadata_value=airflow_dag_run_link,
625625
)
626626
)
627+
airflow_meta.append(
628+
bigquery.MetadataHistoryRow(
629+
job_uuid=uuid, metadata_key="dag_id", metadata_value=dag_id
630+
)
631+
)
632+
for key, value in context.get("params", {}).items():
633+
airflow_meta.append(
634+
bigquery.MetadataHistoryRow(
635+
job_uuid=uuid,
636+
metadata_key=f"param:{key}",
637+
metadata_value=str(value),
638+
)
639+
)
627640

628641
metadata[index].extend(airflow_meta)
629642
return metadata

0 commit comments

Comments
 (0)