Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
wf restart: adding execution with parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
DonHaul committed Jul 10, 2024
1 parent 803336f commit ddb48c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backoffice/workflows/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def resolve(self, request, pk=None):

@action(detail=True, methods=["post"])
def restart(self, request, pk=None):

params = request.data.get("params", None)
restart_current_task = request.data.get("restart_current_task", False)

workflow = Workflow.objects.get(id=pk)
Expand Down Expand Up @@ -142,8 +144,9 @@ def restart(self, request, pk=None):
f"{airflow_utils.AIRFLOW_BASE_URL}/api/v1/dags/{dag_id}/dagRuns/{pk}",
headers=airflow_utils.AIRFLOW_HEADERS,
)
if response.status_code != 204:
return Response({"error": "Failed to restart"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)

return airflow_utils.trigger_airflow_dag(WORKFLOW_DAG[workflow.workflow_type], pk, params)

return Response({"error": "Failed to restart"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)


Expand Down

0 comments on commit ddb48c3

Please sign in to comment.