From 84e2744541a288a335215788ac2797235d53140a Mon Sep 17 00:00:00 2001 From: DonHaul Date: Tue, 27 Aug 2024 11:38:47 +0200 Subject: [PATCH] w --- backoffice/backoffice/workflows/airflow_utils.py | 6 +++--- backoffice/backoffice/workflows/tests/test_views.py | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backoffice/backoffice/workflows/airflow_utils.py b/backoffice/backoffice/workflows/airflow_utils.py index 6f4faf90..87600585 100644 --- a/backoffice/backoffice/workflows/airflow_utils.py +++ b/backoffice/backoffice/workflows/airflow_utils.py @@ -156,6 +156,9 @@ def restart_workflow_dags(workflow_id, workflow_type, params=None): :param params: parameters of new dag execution :returns: request response """ + import ipdb + + ipdb.set_trace() delete_workflow_dag_runs(workflow_id, workflow_type) return trigger_airflow_dag( @@ -179,9 +182,6 @@ def delete_workflow_dag_runs(workflow_id, workflow_type, params=None): if data is None: data = dag_data["conf"].get("data") - trigger_airflow_dag( - WORKFLOW_DAGS[workflow_type].initialize, str(workflow_id), params or data - ) return JsonResponse( data={"message": f"Dag runs for worfklow {workflow_id} have been deleted"} ) diff --git a/backoffice/backoffice/workflows/tests/test_views.py b/backoffice/backoffice/workflows/tests/test_views.py index eef494ce..b944c317 100644 --- a/backoffice/backoffice/workflows/tests/test_views.py +++ b/backoffice/backoffice/workflows/tests/test_views.py @@ -418,6 +418,9 @@ def test_restart_full_dagrun(self): "api:workflows-authors-restart", kwargs={"pk": self.workflow.id}, ) + import ipdb + + ipdb.set_trace() response = self.api_client.post(url) self.assertEqual(response.status_code, 200) self.assertIn("test", response.json()["conf"]["data"]) @@ -429,8 +432,9 @@ def test_restart_a_task(self): "api:workflows-authors-restart", kwargs={"pk": self.workflow.id}, ) + response = self.api_client.post( - url, json={"task_ids": ["set_workflow_status_to_running"]} + url, format="json", data={"restart_current_task": True} ) self.assertEqual(response.status_code, 200) @@ -441,9 +445,8 @@ def test_restart_with_params(self): "api:workflows-authors-restart", kwargs={"pk": self.workflow.id}, ) - response = self.api_client.post( - url, json={"params": {"workflow_id": self.workflow.id}} + url, format="json", data={"params": {"workflow_id": self.workflow.id}} ) self.assertEqual(response.status_code, 200)