Skip to content

Commit c5c32d5

Browse files
committed
feat: adds event_type in logging messages
1 parent d604bca commit c5c32d5

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

src/aind_airflow_jobs/dag_tasks/base.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,20 @@ def run_task(self):
2929
f"Task function '{task_id}' not found or not callable!"
3030
)
3131

32+
logging.info(
33+
f"Task '{task_id}' starting.",
34+
extra={
35+
"process_name": task_id,
36+
"pipeline_name": "airflow DAG",
37+
"event_type": "stage_start",
38+
},
39+
)
3240
task_func()
3341
logging.info(
3442
f"Task '{task_id}' completed successfully!",
3543
extra={
3644
"process_name": task_id,
3745
"pipeline_name": "airflow DAG",
46+
"event_type": "stage_complete",
3847
},
3948
)

src/aind_airflow_jobs/handlers/slurm_v2_handler.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ def run_job(self):
656656
"pipeline_name": "airflow DAG",
657657
"acquisition_name": job_name,
658658
"job_id": job_id,
659+
"event_type": "stage_start",
659660
},
660661
)
661662
logging.info(
@@ -678,6 +679,16 @@ def run_job(self):
678679
},
679680
)
680681
self._monitor_job(submit_response=submit_response)
682+
logging.info(
683+
f"Job '{job_name}' completed successfully!",
684+
extra={
685+
"process_name": "run_slurm_job",
686+
"pipeline_name": "airflow DAG",
687+
"acquisition_name": job_name,
688+
"job_id": job_id,
689+
"event_type": "stage_complete",
690+
},
691+
)
681692

682693

683694
class SlurmJobSensor:

0 commit comments

Comments
 (0)