From 767ea681bb064cfdcb42083886449a601ce9f84a Mon Sep 17 00:00:00 2001 From: Anthony Lin Date: Tue, 8 May 2018 07:34:25 +0000 Subject: [PATCH] [Fix] Deckhand Create Site Action Tag The workflow should fail if 'armada_build', 'skip_upgrade_airflow' or 'upgrade_airflow' tasks are in 'upstream_failed' state. This can happen if any of the upstream tasks are in failed state. For instance, if there is a failure in the preflight checks for the UCP components, all its associated downstream tasks will stop and its downstream tasks such as 'armada_build' will go into 'upstream_failed' state. As it is right now, the deckhand_create_site_action_tag Operator will treat the above mentioned scenario as successful (since task is in 'upstream_failed' and not 'failed' state) and will proceed to create the 'site-action-success' tag instead of 'site-action-failure' tag. Hence we will need to capture both task states as failed state. This patch set is meant to fix this erroneous behavior. Change-Id: I01066656d4cc9169d85c6a535d8241470761666a --- .../plugins/deckhand_create_site_action_tag.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bin/shipyard_airflow/shipyard_airflow/plugins/deckhand_create_site_action_tag.py b/src/bin/shipyard_airflow/shipyard_airflow/plugins/deckhand_create_site_action_tag.py index 9ce0dfe7..e455f45c 100644 --- a/src/bin/shipyard_airflow/shipyard_airflow/plugins/deckhand_create_site_action_tag.py +++ b/src/bin/shipyard_airflow/shipyard_airflow/plugins/deckhand_create_site_action_tag.py @@ -22,6 +22,7 @@ from airflow.exceptions import AirflowException from deckhand_base_operator import DeckhandBaseOperator +FAILED_STATUSES = ('failed', 'upstream_failed') LOG = logging.getLogger(__name__) @@ -128,10 +129,11 @@ class DeckhandCreateSiteActionTagOperator(DeckhandBaseOperator): task_result[i] = self.check_task_result(i) # Check for failed task(s) - failed_task = [x for x in task if task_result[x] == 'failed'] + failed_task = [x for x in task if task_result[x] in FAILED_STATUSES] if failed_task: - LOG.info("Task(s) in the workflow has/have failed: %s", + LOG.info("Either upstream tasks or tasks in the " + "workflow have failed: %s", ", ".join(failed_task)) return False