From e45de6c3fb6c7f33c1353da8f68cccd5e9213b6a Mon Sep 17 00:00:00 2001 From: DonHaul Date: Tue, 30 Jul 2024 14:16:24 +0200 Subject: [PATCH] user actions: review cassettes --- .../backoffice/workflows/airflow_utils.py | 17 ++-- backoffice/backoffice/workflows/api/views.py | 1 + ...AirflowUtils.test_delete_workflow_dag.yaml | 14 +-- ...tAirflowUtils.test_find_executed_dags.yaml | 26 +++--- ...TestAirflowUtils.test_find_failed_dag.yaml | 30 +++---- ...irflowUtils.test_restart_failed_tasks.yaml | 50 +++++------ ...rflowUtils.test_restart_workflow_dags.yaml | 38 ++++---- ...AirflowUtils.test_trigger_airflow_dag.yaml | 12 +-- ...horWorkflowViewSet.test_accept_author.yaml | 75 +++++++++++----- ...horWorkflowViewSet.test_create_author.yaml | 69 +++++++++++---- ...horWorkflowViewSet.test_reject_author.yaml | 75 +++++++++++----- ...orWorkflowViewSet.test_restart_a_task.yaml | 86 +++++++++++++------ ...kflowViewSet.test_restart_full_dagrun.yaml | 86 +++++++++++++------ ...kflowViewSet.test_restart_with_params.yaml | 79 ++++++++++++----- .../backoffice/workflows/tests/test_views.py | 10 ++- 15 files changed, 443 insertions(+), 225 deletions(-) diff --git a/backoffice/backoffice/workflows/airflow_utils.py b/backoffice/backoffice/workflows/airflow_utils.py index 40de818b..45a5e8c9 100644 --- a/backoffice/backoffice/workflows/airflow_utils.py +++ b/backoffice/backoffice/workflows/airflow_utils.py @@ -2,7 +2,7 @@ from os import environ import requests -from django.http import HttpResponse, JsonResponse +from django.http import JsonResponse from requests.exceptions import RequestException from rest_framework import status @@ -35,10 +35,9 @@ def trigger_airflow_dag(dag_id, workflow_id, extra_data=None): try: logger.info( - "Triggering DAG %s with data: %s and %s %s", + "Triggering DAG %s with data: %s and %s", dag_id, data, - AIRFLOW_HEADERS, url, ) response = requests.post(url, json=data, headers=AIRFLOW_HEADERS) @@ -69,10 +68,9 @@ def restart_failed_tasks(workflow_id, workflow_type): try: logger.info( - "Clearing Failed Tasks of DAG %s with data: %s and %s %s", + "Clearing Failed Tasks of DAG %s with data: %s and %s", dag_id, data, - AIRFLOW_HEADERS, url, ) response = requests.post( @@ -132,9 +130,8 @@ def delete_workflow_dag(dag_id, workflow_id): url = f"{AIRFLOW_BASE_URL}/api/v1/dags/{dag_id}/dagRuns/{str(workflow_id)}" try: logger.info( - "Deketing dag Failed Tasks of DAG %s with no data and %s %s", + "Deleting dag Failed Tasks of DAG %s with no data and %s", dag_id, - AIRFLOW_HEADERS, url, ) response = requests.delete( @@ -142,9 +139,11 @@ def delete_workflow_dag(dag_id, workflow_id): headers=AIRFLOW_HEADERS, ) response.raise_for_status() - return HttpResponse() + return JsonResponse({"message": "Successfully deleted DAG"}) except RequestException: - return HttpResponse(status=status.HTTP_424_FAILED_DEPENDENCY) + return JsonResponse( + {"error": "Failed to delete DAG"}, status=status.HTTP_424_FAILED_DEPENDENCY + ) def restart_workflow_dags(workflow_id, workflow_type, params=None): diff --git a/backoffice/backoffice/workflows/api/views.py b/backoffice/backoffice/workflows/api/views.py index 97b66cfc..40641cea 100644 --- a/backoffice/backoffice/workflows/api/views.py +++ b/backoffice/backoffice/workflows/api/views.py @@ -123,6 +123,7 @@ def resolve(self, request, pk=None): ResolutionDags[serializer.validated_data["value"]], pk, ) + return airflow_utils.trigger_airflow_dag( ResolutionDags[serializer.validated_data["value"]].label, pk, extra_data ) diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_delete_workflow_dag.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_delete_workflow_dag.yaml index dd1bf454..4ffd90a2 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_delete_workflow_dag.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_delete_workflow_dag.yaml @@ -19,10 +19,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:29:54.362977+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:29:54.362977+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:29:54.362977+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:29:54.362977+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:13:41.736880+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:13:41.736880+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:13:41.736880+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:13:41.736880+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -33,7 +33,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:41 GMT Server: - gunicorn X-Robots-Tag: @@ -65,7 +65,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:41 GMT Server: - gunicorn X-Robots-Tag: @@ -101,7 +101,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:41 GMT Server: - gunicorn X-Robots-Tag: diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_executed_dags.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_executed_dags.yaml index 84cb5ffc..da907575 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_executed_dags.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_executed_dags.yaml @@ -19,10 +19,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:29:54.646527+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:29:54.646527+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:29:54.646527+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:29:54.646527+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:13:42.009672+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:13:42.009672+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:13:42.009672+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:13:42.009672+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -33,7 +33,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:42 GMT Server: - gunicorn X-Robots-Tag: @@ -58,10 +58,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:29:54.646527+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:29:54.646527+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:29:54.646527+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:29:54.646527+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:13:42.009672+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:13:42.009672+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:13:42.009672+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:13:42.009672+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -72,7 +72,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:42 GMT Server: - gunicorn X-Robots-Tag: @@ -106,7 +106,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:42 GMT Server: - gunicorn X-Robots-Tag: @@ -140,7 +140,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:42 GMT Server: - gunicorn X-Robots-Tag: @@ -172,7 +172,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:29:54 GMT + - Tue, 30 Jul 2024 12:13:42 GMT Server: - gunicorn X-Robots-Tag: diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_failed_dag.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_failed_dag.yaml index f15c976a..c7a354fa 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_failed_dag.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_find_failed_dag.yaml @@ -19,10 +19,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:29:55.039650+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:29:55.039650+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:29:55.039650+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:29:55.039650+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:13:42.394528+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:13:42.394528+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:13:42.394528+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:13:42.394528+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -33,7 +33,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:29:55 GMT + - Tue, 30 Jul 2024 12:13:42 GMT Server: - gunicorn X-Robots-Tag: @@ -58,12 +58,12 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:29:55.039650+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:29:55.039650+00:00\",\n \"end_date\": - \"2024-07-30T08:30:12.831165+00:00\",\n \"execution_date\": \"2024-07-30T08:29:55.039650+00:00\",\n - \ \"external_trigger\": true,\n \"last_scheduling_decision\": \"2024-07-30T08:30:12.828982+00:00\",\n - \ \"logical_date\": \"2024-07-30T08:29:55.039650+00:00\",\n \"note\": null,\n - \ \"run_type\": \"manual\",\n \"start_date\": \"2024-07-30T08:29:55.206573+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:13:42.394528+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:13:42.394528+00:00\",\n \"end_date\": + \"2024-07-30T12:14:01.291731+00:00\",\n \"execution_date\": \"2024-07-30T12:13:42.394528+00:00\",\n + \ \"external_trigger\": true,\n \"last_scheduling_decision\": \"2024-07-30T12:14:01.290717+00:00\",\n + \ \"logical_date\": \"2024-07-30T12:13:42.394528+00:00\",\n \"note\": null,\n + \ \"run_type\": \"manual\",\n \"start_date\": \"2024-07-30T12:13:43.261644+00:00\",\n \ \"state\": \"failed\"\n}\n" headers: Connection: @@ -73,7 +73,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:15 GMT + - Tue, 30 Jul 2024 12:14:02 GMT Server: - gunicorn X-Robots-Tag: @@ -107,7 +107,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:30:15 GMT + - Tue, 30 Jul 2024 12:14:02 GMT Server: - gunicorn X-Robots-Tag: @@ -141,7 +141,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:30:15 GMT + - Tue, 30 Jul 2024 12:14:02 GMT Server: - gunicorn X-Robots-Tag: @@ -173,7 +173,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:15 GMT + - Tue, 30 Jul 2024 12:14:02 GMT Server: - gunicorn X-Robots-Tag: diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_failed_tasks.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_failed_tasks.yaml index f0a4ec20..6d156f84 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_failed_tasks.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_failed_tasks.yaml @@ -19,10 +19,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:30:15.450284+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:30:15.450284+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:30:15.450284+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:30:15.450284+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:14:02.777854+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:02.777854+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:02.777854+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:02.777854+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -33,7 +33,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:15 GMT + - Tue, 30 Jul 2024 12:14:02 GMT Server: - gunicorn X-Robots-Tag: @@ -58,12 +58,12 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:30:15.450284+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:30:15.450284+00:00\",\n \"end_date\": - \"2024-07-30T08:30:33.523185+00:00\",\n \"execution_date\": \"2024-07-30T08:30:15.450284+00:00\",\n - \ \"external_trigger\": true,\n \"last_scheduling_decision\": \"2024-07-30T08:30:33.521865+00:00\",\n - \ \"logical_date\": \"2024-07-30T08:30:15.450284+00:00\",\n \"note\": null,\n - \ \"run_type\": \"manual\",\n \"start_date\": \"2024-07-30T08:30:15.499846+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:14:02.777854+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:02.777854+00:00\",\n \"end_date\": + \"2024-07-30T12:14:20.320392+00:00\",\n \"execution_date\": \"2024-07-30T12:14:02.777854+00:00\",\n + \ \"external_trigger\": true,\n \"last_scheduling_decision\": \"2024-07-30T12:14:20.318638+00:00\",\n + \ \"logical_date\": \"2024-07-30T12:14:02.777854+00:00\",\n \"note\": null,\n + \ \"run_type\": \"manual\",\n \"start_date\": \"2024-07-30T12:14:03.400650+00:00\",\n \ \"state\": \"failed\"\n}\n" headers: Connection: @@ -73,7 +73,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:35 GMT + - Tue, 30 Jul 2024 12:14:22 GMT Server: - gunicorn X-Robots-Tag: @@ -107,7 +107,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:30:35 GMT + - Tue, 30 Jul 2024 12:14:22 GMT Server: - gunicorn X-Robots-Tag: @@ -141,7 +141,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:30:35 GMT + - Tue, 30 Jul 2024 12:14:22 GMT Server: - gunicorn X-Robots-Tag: @@ -169,16 +169,16 @@ interactions: body: string: "{\n \"task_instances\": [\n {\n \"dag_id\": \"author_create_initialization_dag\",\n \ \"dag_run_id\": \"00000000-0000-0000-0000-000000000001\",\n \"execution_date\": - \"2024-07-30T08:30:15.450284+00:00\",\n \"task_id\": \"set_workflow_status_to_running\"\n + \"2024-07-30T12:14:02.777854+00:00\",\n \"task_id\": \"create_author_create_user_ticket\"\n \ },\n {\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"execution_date\": \"2024-07-30T08:30:15.450284+00:00\",\n - \ \"task_id\": \"set_schema\"\n },\n {\n \"dag_id\": \"author_create_initialization_dag\",\n - \ \"dag_run_id\": \"00000000-0000-0000-0000-000000000001\",\n \"execution_date\": - \"2024-07-30T08:30:15.450284+00:00\",\n \"task_id\": \"create_author_create_user_ticket\"\n - \ },\n {\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"execution_date\": \"2024-07-30T08:30:15.450284+00:00\",\n - \ \"task_id\": \"set_author_create_workflow_status_to_approval\"\n }\n - \ ]\n}\n" + \"00000000-0000-0000-0000-000000000001\",\n \"execution_date\": \"2024-07-30T12:14:02.777854+00:00\",\n + \ \"task_id\": \"set_author_create_workflow_status_to_approval\"\n },\n + \ {\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": + \"00000000-0000-0000-0000-000000000001\",\n \"execution_date\": \"2024-07-30T12:14:02.777854+00:00\",\n + \ \"task_id\": \"set_workflow_status_to_running\"\n },\n {\n \"dag_id\": + \"author_create_initialization_dag\",\n \"dag_run_id\": \"00000000-0000-0000-0000-000000000001\",\n + \ \"execution_date\": \"2024-07-30T12:14:02.777854+00:00\",\n \"task_id\": + \"set_schema\"\n }\n ]\n}\n" headers: Connection: - close @@ -187,7 +187,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:35 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -219,7 +219,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:35 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_workflow_dags.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_workflow_dags.yaml index 9b65560f..c1a5c53c 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_workflow_dags.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_restart_workflow_dags.yaml @@ -19,10 +19,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:30:35.963602+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:30:35.963602+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:30:35.963602+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:30:35.963602+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:14:23.238128+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:23.238128+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:23.238128+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:23.238128+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -33,7 +33,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:35 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -58,10 +58,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:30:35.963602+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:30:35.963602+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:30:35.963602+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:30:35.963602+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:14:23.238128+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:23.238128+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:23.238128+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:23.238128+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -72,7 +72,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -106,7 +106,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -140,7 +140,7 @@ interactions: Content-Type: - application/problem+json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -172,7 +172,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -200,10 +200,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:30:36.274685+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:30:36.274685+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:30:36.274685+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:30:36.274685+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:14:23.534233+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:23.534233+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:23.534233+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:23.534233+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -214,7 +214,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -246,7 +246,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_trigger_airflow_dag.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_trigger_airflow_dag.yaml index b5f17101..9fbb4d22 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_trigger_airflow_dag.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAirflowUtils.test_trigger_airflow_dag.yaml @@ -19,10 +19,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000001\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T08:30:36.501705+00:00\",\n - \ \"data_interval_start\": \"2024-07-30T08:30:36.501705+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-30T08:30:36.501705+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T08:30:36.501705+00:00\",\n + \"00000000-0000-0000-0000-000000000001\",\n \"data_interval_end\": \"2024-07-30T12:14:23.764312+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:23.764312+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:23.764312+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:23.764312+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -33,7 +33,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: @@ -65,7 +65,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:30:36 GMT + - Tue, 30 Jul 2024 12:14:23 GMT Server: - gunicorn X-Robots-Tag: diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_accept_author.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_accept_author.yaml index 0292d427..f360ebca 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_accept_author.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_accept_author.yaml @@ -17,25 +17,30 @@ interactions: uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_initialization_dag' - and DAGRun ID: '00000000-0000-0000-0000-000000000000' already exists\",\n - \ \"status\": 409,\n \"title\": \"Conflict\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/AlreadyExists\"\n}\n" + string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n + \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:26.875778+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:26.875778+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:26.875778+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:26.875778+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '302' + - '579' Content-Type: - - application/problem+json + - application/json Date: - - Tue, 30 Jul 2024 08:37:55 GMT + - Tue, 30 Jul 2024 12:14:26 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 409 - message: CONFLICT + code: 200 + message: OK - request: body: '{"dag_run_id": "00000000-0000-0000-0000-000000000000", "conf": {"workflow_id": "00000000-0000-0000-0000-000000000000", "create_ticket": true}}' @@ -57,10 +62,10 @@ interactions: string: "{\n \"conf\": {\n \"create_ticket\": true,\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n },\n \"dag_id\": \"author_create_approved_dag\",\n \ \"dag_run_id\": \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": - \"2024-07-30T08:37:55.067410+00:00\",\n \"data_interval_start\": \"2024-07-30T08:37:55.067410+00:00\",\n - \ \"end_date\": null,\n \"execution_date\": \"2024-07-30T08:37:55.067410+00:00\",\n + \"2024-07-30T12:14:26.939226+00:00\",\n \"data_interval_start\": \"2024-07-30T12:14:26.939226+00:00\",\n + \ \"end_date\": null,\n \"execution_date\": \"2024-07-30T12:14:26.939226+00:00\",\n \ \"external_trigger\": true,\n \"last_scheduling_decision\": null,\n \"logical_date\": - \"2024-07-30T08:37:55.067410+00:00\",\n \"note\": null,\n \"run_type\": + \"2024-07-30T12:14:26.939226+00:00\",\n \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \"state\": \"queued\"\n}\n" headers: Connection: @@ -70,7 +75,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:37:55 GMT + - Tue, 30 Jul 2024 12:14:26 GMT Server: - gunicorn X-Robots-Tag: @@ -92,26 +97,54 @@ interactions: Content-Type: - application/json method: DELETE - uri: http://airflow-webserver:8080/api/v1/dags/author_create_approved_dag/dagRuns/Workflow%20object%20(00000000-0000-0000-0000-000000000000) + uri: http://airflow-webserver:8080/api/v1/dags/author_create_approved_dag/dagRuns/00000000-0000-0000-0000-000000000000 response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_approved_dag' - and DagRun ID: 'Workflow object (00000000-0000-0000-0000-000000000000)' not - found\",\n \"status\": 404,\n \"title\": \"Not Found\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/NotFound\"\n}\n" + string: '' headers: Connection: - close + Content-Type: + - application/json + Date: + - Tue, 30 Jul 2024 12:14:27 GMT + Server: + - gunicorn + X-Robots-Tag: + - noindex, nofollow + status: + code: 204 + message: NO CONTENT +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive Content-Length: - - '305' + - '0' Content-Type: - - application/problem+json + - application/json + method: DELETE + uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/00000000-0000-0000-0000-000000000000 + response: + body: + string: '' + headers: + Connection: + - close + Content-Type: + - application/json Date: - - Tue, 30 Jul 2024 08:37:55 GMT + - Tue, 30 Jul 2024 12:14:27 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 404 - message: NOT FOUND + code: 204 + message: NO CONTENT version: 1 diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_create_author.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_create_author.yaml index ee26b056..8839ffae 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_create_author.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_create_author.yaml @@ -17,28 +17,33 @@ interactions: uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_initialization_dag' - and DAGRun ID: '00000000-0000-0000-0000-000000000000' already exists\",\n - \ \"status\": 409,\n \"title\": \"Conflict\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/AlreadyExists\"\n}\n" + string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n + \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:27.272986+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:27.272986+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:27.272986+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:27.272986+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '302' + - '579' Content-Type: - - application/problem+json + - application/json Date: - - Tue, 30 Jul 2024 08:37:55 GMT + - Tue, 30 Jul 2024 12:14:27 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 409 - message: CONFLICT + code: 200 + message: OK - request: - body: '{"dag_run_id": "cd4a73f3-7927-45b4-8a09-0c7187ac9b9b", "conf": {"workflow_id": - "cd4a73f3-7927-45b4-8a09-0c7187ac9b9b", "native_name": "NATIVE_NAME", "alternate_name": + body: '{"dag_run_id": "5c7e5277-c802-4bb6-871e-f4e8597204ea", "conf": {"workflow_id": + "5c7e5277-c802-4bb6-871e-f4e8597204ea", "native_name": "NATIVE_NAME", "alternate_name": "NAME", "display_name": "FIRST_NAME", "family_name": "LAST_NAME", "given_name": "GIVEN_NAME"}}' headers: @@ -59,12 +64,12 @@ interactions: string: "{\n \"conf\": {\n \"alternate_name\": \"NAME\",\n \"display_name\": \"FIRST_NAME\",\n \"family_name\": \"LAST_NAME\",\n \"given_name\": \"GIVEN_NAME\",\n \"native_name\": \"NATIVE_NAME\",\n \"workflow_id\": - \"cd4a73f3-7927-45b4-8a09-0c7187ac9b9b\"\n },\n \"dag_id\": \"author_create_initialization_dag\",\n - \ \"dag_run_id\": \"cd4a73f3-7927-45b4-8a09-0c7187ac9b9b\",\n \"data_interval_end\": - \"2024-07-30T08:37:55.637380+00:00\",\n \"data_interval_start\": \"2024-07-30T08:37:55.637380+00:00\",\n - \ \"end_date\": null,\n \"execution_date\": \"2024-07-30T08:37:55.637380+00:00\",\n + \"5c7e5277-c802-4bb6-871e-f4e8597204ea\"\n },\n \"dag_id\": \"author_create_initialization_dag\",\n + \ \"dag_run_id\": \"5c7e5277-c802-4bb6-871e-f4e8597204ea\",\n \"data_interval_end\": + \"2024-07-30T12:14:27.429196+00:00\",\n \"data_interval_start\": \"2024-07-30T12:14:27.429196+00:00\",\n + \ \"end_date\": null,\n \"execution_date\": \"2024-07-30T12:14:27.429196+00:00\",\n \ \"external_trigger\": true,\n \"last_scheduling_decision\": null,\n \"logical_date\": - \"2024-07-30T08:37:55.637380+00:00\",\n \"note\": null,\n \"run_type\": + \"2024-07-30T12:14:27.429196+00:00\",\n \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \"state\": \"queued\"\n}\n" headers: Connection: @@ -74,7 +79,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:37:55 GMT + - Tue, 30 Jul 2024 12:14:27 GMT Server: - gunicorn X-Robots-Tag: @@ -82,4 +87,36 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + method: DELETE + uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/00000000-0000-0000-0000-000000000000 + response: + body: + string: '' + headers: + Connection: + - close + Content-Type: + - application/json + Date: + - Tue, 30 Jul 2024 12:14:27 GMT + Server: + - gunicorn + X-Robots-Tag: + - noindex, nofollow + status: + code: 204 + message: NO CONTENT version: 1 diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_reject_author.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_reject_author.yaml index 31f0454d..2c88c57b 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_reject_author.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_reject_author.yaml @@ -17,25 +17,30 @@ interactions: uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_initialization_dag' - and DAGRun ID: '00000000-0000-0000-0000-000000000000' already exists\",\n - \ \"status\": 409,\n \"title\": \"Conflict\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/AlreadyExists\"\n}\n" + string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n + \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:27.746951+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:27.746951+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:27.746951+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:27.746951+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '302' + - '579' Content-Type: - - application/problem+json + - application/json Date: - - Tue, 30 Jul 2024 08:37:55 GMT + - Tue, 30 Jul 2024 12:14:27 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 409 - message: CONFLICT + code: 200 + message: OK - request: body: '{"dag_run_id": "00000000-0000-0000-0000-000000000000", "conf": {"workflow_id": "00000000-0000-0000-0000-000000000000", "create_ticket": true}}' @@ -57,10 +62,10 @@ interactions: string: "{\n \"conf\": {\n \"create_ticket\": true,\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n },\n \"dag_id\": \"author_create_rejected_dag\",\n \ \"dag_run_id\": \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": - \"2024-07-30T08:37:55.930803+00:00\",\n \"data_interval_start\": \"2024-07-30T08:37:55.930803+00:00\",\n - \ \"end_date\": null,\n \"execution_date\": \"2024-07-30T08:37:55.930803+00:00\",\n + \"2024-07-30T12:14:27.822819+00:00\",\n \"data_interval_start\": \"2024-07-30T12:14:27.822819+00:00\",\n + \ \"end_date\": null,\n \"execution_date\": \"2024-07-30T12:14:27.822819+00:00\",\n \ \"external_trigger\": true,\n \"last_scheduling_decision\": null,\n \"logical_date\": - \"2024-07-30T08:37:55.930803+00:00\",\n \"note\": null,\n \"run_type\": + \"2024-07-30T12:14:27.822819+00:00\",\n \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \"state\": \"queued\"\n}\n" headers: Connection: @@ -70,7 +75,7 @@ interactions: Content-Type: - application/json Date: - - Tue, 30 Jul 2024 08:37:55 GMT + - Tue, 30 Jul 2024 12:14:27 GMT Server: - gunicorn X-Robots-Tag: @@ -92,26 +97,54 @@ interactions: Content-Type: - application/json method: DELETE - uri: http://airflow-webserver:8080/api/v1/dags/author_create_rejected_dag/dagRuns/Workflow%20object%20(00000000-0000-0000-0000-000000000000) + uri: http://airflow-webserver:8080/api/v1/dags/author_create_rejected_dag/dagRuns/00000000-0000-0000-0000-000000000000 response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_rejected_dag' - and DagRun ID: 'Workflow object (00000000-0000-0000-0000-000000000000)' not - found\",\n \"status\": 404,\n \"title\": \"Not Found\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/NotFound\"\n}\n" + string: '' headers: Connection: - close + Content-Type: + - application/json + Date: + - Tue, 30 Jul 2024 12:14:27 GMT + Server: + - gunicorn + X-Robots-Tag: + - noindex, nofollow + status: + code: 204 + message: NO CONTENT +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive Content-Length: - - '305' + - '0' Content-Type: - - application/problem+json + - application/json + method: DELETE + uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/00000000-0000-0000-0000-000000000000 + response: + body: + string: '' + headers: + Connection: + - close + Content-Type: + - application/json Date: - - Tue, 30 Jul 2024 08:37:56 GMT + - Tue, 30 Jul 2024 12:14:27 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 404 - message: NOT FOUND + code: 204 + message: NO CONTENT version: 1 diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_a_task.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_a_task.yaml index 92229468..8f82ba2a 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_a_task.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_a_task.yaml @@ -17,25 +17,30 @@ interactions: uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_initialization_dag' - and DAGRun ID: '00000000-0000-0000-0000-000000000000' already exists\",\n - \ \"status\": 409,\n \"title\": \"Conflict\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/AlreadyExists\"\n}\n" + string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n + \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:28.199984+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:28.199984+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:28.199984+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:28.199984+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '302' + - '579' Content-Type: - - application/problem+json + - application/json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 409 - message: CONFLICT + code: 200 + message: OK - request: body: null headers: @@ -53,22 +58,21 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-29T14:35:25.026657+00:00\",\n - \ \"data_interval_start\": \"2024-07-29T14:35:25.026657+00:00\",\n \"end_date\": - \"2024-07-29T14:35:44.018598+00:00\",\n \"execution_date\": \"2024-07-29T14:35:25.026657+00:00\",\n - \ \"external_trigger\": true,\n \"last_scheduling_decision\": \"2024-07-29T14:35:44.016868+00:00\",\n - \ \"logical_date\": \"2024-07-29T14:35:25.026657+00:00\",\n \"note\": null,\n - \ \"run_type\": \"manual\",\n \"start_date\": \"2024-07-29T14:35:25.938932+00:00\",\n - \ \"state\": \"failed\"\n}\n" + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:28.199984+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:28.199984+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:28.199984+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:28.199984+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '669' + - '579' Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -102,7 +106,7 @@ interactions: Content-Type: - application/problem+json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -136,7 +140,7 @@ interactions: Content-Type: - application/problem+json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -168,7 +172,7 @@ interactions: Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -196,10 +200,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-29T14:36:56.557910+00:00\",\n - \ \"data_interval_start\": \"2024-07-29T14:36:56.557910+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-29T14:36:56.557910+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-29T14:36:56.557910+00:00\",\n + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:28.496186+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:28.496186+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:28.496186+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:28.496186+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -210,7 +214,7 @@ interactions: Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -218,4 +222,36 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + method: DELETE + uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/00000000-0000-0000-0000-000000000000 + response: + body: + string: '' + headers: + Connection: + - close + Content-Type: + - application/json + Date: + - Tue, 30 Jul 2024 12:14:28 GMT + Server: + - gunicorn + X-Robots-Tag: + - noindex, nofollow + status: + code: 204 + message: NO CONTENT version: 1 diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_full_dagrun.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_full_dagrun.yaml index aec4e7e0..9cfc7cdc 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_full_dagrun.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_full_dagrun.yaml @@ -17,25 +17,30 @@ interactions: uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_initialization_dag' - and DAGRun ID: '00000000-0000-0000-0000-000000000000' already exists\",\n - \ \"status\": 409,\n \"title\": \"Conflict\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/AlreadyExists\"\n}\n" + string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n + \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:28.743346+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:28.743346+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:28.743346+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:28.743346+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '302' + - '579' Content-Type: - - application/problem+json + - application/json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 409 - message: CONFLICT + code: 200 + message: OK - request: body: null headers: @@ -53,22 +58,21 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-29T14:36:56.557910+00:00\",\n - \ \"data_interval_start\": \"2024-07-29T14:36:56.557910+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-29T14:36:56.557910+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": \"2024-07-29T14:36:56.638434+00:00\",\n - \ \"logical_date\": \"2024-07-29T14:36:56.557910+00:00\",\n \"note\": null,\n - \ \"run_type\": \"manual\",\n \"start_date\": \"2024-07-29T14:36:56.590540+00:00\",\n - \ \"state\": \"running\"\n}\n" + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:28.743346+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:28.743346+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:28.743346+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:28.743346+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '640' + - '579' Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -102,7 +106,7 @@ interactions: Content-Type: - application/problem+json Date: - - Mon, 29 Jul 2024 14:36:56 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -136,7 +140,7 @@ interactions: Content-Type: - application/problem+json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -168,7 +172,7 @@ interactions: Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:28 GMT Server: - gunicorn X-Robots-Tag: @@ -196,10 +200,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-29T14:36:57.124733+00:00\",\n - \ \"data_interval_start\": \"2024-07-29T14:36:57.124733+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-29T14:36:57.124733+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-29T14:36:57.124733+00:00\",\n + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:29.037550+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:29.037550+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:29.037550+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:29.037550+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -210,7 +214,7 @@ interactions: Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:29 GMT Server: - gunicorn X-Robots-Tag: @@ -218,4 +222,36 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + method: DELETE + uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/00000000-0000-0000-0000-000000000000 + response: + body: + string: '' + headers: + Connection: + - close + Content-Type: + - application/json + Date: + - Tue, 30 Jul 2024 12:14:29 GMT + Server: + - gunicorn + X-Robots-Tag: + - noindex, nofollow + status: + code: 204 + message: NO CONTENT version: 1 diff --git a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_with_params.yaml b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_with_params.yaml index 8ecf19b3..ca6dbd45 100644 --- a/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_with_params.yaml +++ b/backoffice/backoffice/workflows/tests/cassettes/TestAuthorWorkflowViewSet.test_restart_with_params.yaml @@ -17,25 +17,30 @@ interactions: uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns response: body: - string: "{\n \"detail\": \"DAGRun with DAG ID: 'author_create_initialization_dag' - and DAGRun ID: '00000000-0000-0000-0000-000000000000' already exists\",\n - \ \"status\": 409,\n \"title\": \"Conflict\",\n \"type\": \"https://airflow.apache.org/docs/apache-airflow/2.8.3/stable-rest-api-ref.html#section/Errors/AlreadyExists\"\n}\n" + string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n + \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:29.280024+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:29.280024+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:29.280024+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:29.280024+00:00\",\n + \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n + \ \"state\": \"queued\"\n}\n" headers: Connection: - close Content-Length: - - '302' + - '579' Content-Type: - - application/problem+json + - application/json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:29 GMT Server: - gunicorn X-Robots-Tag: - noindex, nofollow status: - code: 409 - message: CONFLICT + code: 200 + message: OK - request: body: null headers: @@ -53,10 +58,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-29T14:36:57.124733+00:00\",\n - \ \"data_interval_start\": \"2024-07-29T14:36:57.124733+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-29T14:36:57.124733+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-29T14:36:57.124733+00:00\",\n + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:29.280024+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:29.280024+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:29.280024+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:29.280024+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -67,7 +72,7 @@ interactions: Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:29 GMT Server: - gunicorn X-Robots-Tag: @@ -101,7 +106,7 @@ interactions: Content-Type: - application/problem+json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:29 GMT Server: - gunicorn X-Robots-Tag: @@ -135,7 +140,7 @@ interactions: Content-Type: - application/problem+json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:29 GMT Server: - gunicorn X-Robots-Tag: @@ -167,7 +172,7 @@ interactions: Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:29 GMT Server: - gunicorn X-Robots-Tag: @@ -195,10 +200,10 @@ interactions: body: string: "{\n \"conf\": {\n \"workflow_id\": \"00000000-0000-0000-0000-000000000000\"\n \ },\n \"dag_id\": \"author_create_initialization_dag\",\n \"dag_run_id\": - \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-29T14:36:57.624294+00:00\",\n - \ \"data_interval_start\": \"2024-07-29T14:36:57.624294+00:00\",\n \"end_date\": - null,\n \"execution_date\": \"2024-07-29T14:36:57.624294+00:00\",\n \"external_trigger\": - true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-29T14:36:57.624294+00:00\",\n + \"00000000-0000-0000-0000-000000000000\",\n \"data_interval_end\": \"2024-07-30T12:14:29.570410+00:00\",\n + \ \"data_interval_start\": \"2024-07-30T12:14:29.570410+00:00\",\n \"end_date\": + null,\n \"execution_date\": \"2024-07-30T12:14:29.570410+00:00\",\n \"external_trigger\": + true,\n \"last_scheduling_decision\": null,\n \"logical_date\": \"2024-07-30T12:14:29.570410+00:00\",\n \ \"note\": null,\n \"run_type\": \"manual\",\n \"start_date\": null,\n \ \"state\": \"queued\"\n}\n" headers: @@ -209,7 +214,7 @@ interactions: Content-Type: - application/json Date: - - Mon, 29 Jul 2024 14:36:57 GMT + - Tue, 30 Jul 2024 12:14:29 GMT Server: - gunicorn X-Robots-Tag: @@ -217,4 +222,36 @@ interactions: status: code: 200 message: OK +- request: + body: null + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '0' + Content-Type: + - application/json + method: DELETE + uri: http://airflow-webserver:8080/api/v1/dags/author_create_initialization_dag/dagRuns/00000000-0000-0000-0000-000000000000 + response: + body: + string: '' + headers: + Connection: + - close + Content-Type: + - application/json + Date: + - Tue, 30 Jul 2024 12:14:29 GMT + Server: + - gunicorn + X-Robots-Tag: + - noindex, nofollow + status: + code: 204 + message: NO CONTENT version: 1 diff --git a/backoffice/backoffice/workflows/tests/test_views.py b/backoffice/backoffice/workflows/tests/test_views.py index 22fe4a7b..fc40b5df 100644 --- a/backoffice/backoffice/workflows/tests/test_views.py +++ b/backoffice/backoffice/workflows/tests/test_views.py @@ -266,6 +266,12 @@ def setUp(self): self.workflow.data, ) + def tearDown(self): + super().tearDown() + airflow_utils.delete_workflow_dag( + WORKFLOW_DAGS[self.workflow.workflow_type][0], str(self.workflow.id) + ) + @pytest.mark.vcr() def test_create_author(self): self.api_client.force_authenticate(user=self.curator) @@ -303,7 +309,7 @@ def test_accept_author(self): self.assertEqual(response.status_code, 200) airflow_utils.delete_workflow_dag( - WORKFLOW_DAGS["AUTHOR_CREATE"][1], self.workflow + WORKFLOW_DAGS["AUTHOR_CREATE"][1], str(self.workflow.id) ) @pytest.mark.vcr() @@ -322,7 +328,7 @@ def test_reject_author(self): self.assertEqual(response.status_code, 200) airflow_utils.delete_workflow_dag( - WORKFLOW_DAGS["AUTHOR_CREATE"][2], self.workflow + WORKFLOW_DAGS["AUTHOR_CREATE"][2], str(self.workflow.id) ) @pytest.mark.vcr()