File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121RESET_DAG_DOC = """
2222DAG to reset the data in the BCIERS database to a freshly deployed state.
23+
24+ - **cycle_backend**: Whether to restart the backend deployment once the database has been wiped
2325"""
2426
2527
3234 doc_md = RESET_DAG_DOC ,
3335 tags = ['bciers' ],
3436)
35- def reset_data ():
37+ def reset_data (cycle_backend : bool = True ):
3638
3739 @task
3840 def reset_attachment_storage_task ():
@@ -42,6 +44,10 @@ def reset_attachment_storage_task():
4244 def reset_data_task ():
4345 trigger_k8s_cronjob ("reset-database" , BCIERS_NAMESPACE )
4446
47+ @task .short_circuit
48+ def should_cycle_backend (** context ):
49+ return context ["params" ]["cycle_backend" ]
50+
4551 cycle_backend_pod_task = KubernetesJobOperator (
4652 task_id = "cycle-backend-pod" ,
4753 name = "cycle-backend-pod" ,
@@ -59,7 +65,12 @@ def reset_data_task():
5965 trigger_dag_id = WAIT_FOR_BACKEND_ROLLOUT_DAG_NAME ,
6066 )
6167
62- ([reset_attachment_storage_task (), reset_data_task ()] >> cycle_backend_pod_task >> trigger_wait_for_backend_rollout )
68+ (
69+ [reset_attachment_storage_task (), reset_data_task ()]
70+ >> should_cycle_backend ()
71+ >> cycle_backend_pod_task
72+ >> trigger_wait_for_backend_rollout
73+ )
6374
6475
6576ROLLOUT_DAG_DOC = """
You can’t perform that action at this time.
0 commit comments