From f8fb44b7a035ee03ed1feb4fa8b9da4fce5d50a8 Mon Sep 17 00:00:00 2001 From: Anthony Lin Date: Fri, 13 Apr 2018 08:00:02 +0000 Subject: [PATCH] Change Name of deckhand_get_design_version Subdag We will need to provide distinctive/unique step_id/step_name in order to make use of the Shipyard logs API/CLI. It is found during testing that 'deckhand_get_design_version' is used as both the name of the subdag as well as 'task_id' [0]. As such, we will only be able to retrieve the logs of the subdag when we run a query with step_id as 'deckhand_get_design_version'. This is an issue and hence we will change the name of the subdag so that it is different from the task_id. In this way we will be retrieve the logs for the subdag as well as the task. [0] Current output of describe step (note the name of the steps in failed state): Steps Index State step/01CAYXMTK1ECXBK0SF4MQBYEND/action_xcom 1 success step/01CAYXMTK1ECXBK0SF4MQBYEND/dag_concurrency_check 2 success step/01CAYXMTK1ECXBK0SF4MQBYEND/preflight 3 success step/01CAYXMTK1ECXBK0SF4MQBYEND/deckhand_get_design_version 4 failed step/01CAYXMTK1ECXBK0SF4MQBYEND/dag_deployment_configuration 5 upstream_failed step/01CAYXMTK1ECXBK0SF4MQBYEND/validate_site_design 6 upstream_failed step/01CAYXMTK1ECXBK0SF4MQBYEND/deckhand_get_design_version 7 failed step/01CAYXMTK1ECXBK0SF4MQBYEND/drydock_build 8 upstream_failed step/01CAYXMTK1ECXBK0SF4MQBYEND/ucp_preflight_check 9 success step/01CAYXMTK1ECXBK0SF4MQBYEND/k8s_preflight_check 10 success step/01CAYXMTK1ECXBK0SF4MQBYEND/shipyard_retrieve_rendered_doc 11 upstream_failed step/01CAYXMTK1ECXBK0SF4MQBYEND/armada_build 12 upstream_failed Change-Id: I191cb8509c8d3d8e63f539b25c1693e9b8794aac --- shipyard_airflow/dags/common_step_factory.py | 2 +- shipyard_airflow/dags/dag_names.py | 2 +- shipyard_airflow/plugins/deckhand_base_operator.py | 6 +++--- .../plugins/deployment_configuration_operator.py | 2 +- shipyard_airflow/plugins/xcom_puller.py | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/shipyard_airflow/dags/common_step_factory.py b/shipyard_airflow/dags/common_step_factory.py index f05498c8..b920d895 100644 --- a/shipyard_airflow/dags/common_step_factory.py +++ b/shipyard_airflow/dags/common_step_factory.py @@ -88,7 +88,7 @@ class CommonStepFactory(object): on_failure_callback=step_failure_handler, dag=self.dag) - def get_get_design_version(self, task_id=dn.DECKHAND_GET_DESIGN_VERSION): + def get_get_design_version(self, task_id=dn.GET_DESIGN_VERSION): """Generate the get design version step Retrieves the version of the design to use from deckhand diff --git a/shipyard_airflow/dags/dag_names.py b/shipyard_airflow/dags/dag_names.py index 1e48e3c7..a7af54e6 100644 --- a/shipyard_airflow/dags/dag_names.py +++ b/shipyard_airflow/dags/dag_names.py @@ -16,7 +16,7 @@ ALL_PREFLIGHT_CHECKS_DAG_NAME = 'preflight' ARMADA_BUILD_DAG_NAME = 'armada_build' DAG_CONCURRENCY_CHECK_DAG_NAME = 'dag_concurrency_check' -DECKHAND_GET_DESIGN_VERSION = 'deckhand_get_design_version' +GET_DESIGN_VERSION = 'get_design_version' GET_DEPLOY_CONF_DAG_NAME = 'dag_deployment_configuration' DRYDOCK_BUILD_DAG_NAME = 'drydock_build' VALIDATE_SITE_DESIGN_DAG_NAME = 'validate_site_design' diff --git a/shipyard_airflow/plugins/deckhand_base_operator.py b/shipyard_airflow/plugins/deckhand_base_operator.py index 53b703db..18899508 100644 --- a/shipyard_airflow/plugins/deckhand_base_operator.py +++ b/shipyard_airflow/plugins/deckhand_base_operator.py @@ -94,8 +94,8 @@ class DeckhandBaseOperator(BaseOperator): self.do_execute() # Push last committed version to xcom for the - # 'deckhand_get_design_version' subdag - if self.sub_dag_name == 'deckhand_get_design_version': + # 'get_design_version' subdag + if self.sub_dag_name == 'get_design_version': return self.committed_ver @shipyard_service_token @@ -145,7 +145,7 @@ class DeckhandBaseOperator(BaseOperator): # 'deckhand_get_design_version' # # NOTE: In the case of 'deploy_site', the dag_id will - # be 'deploy_site.deckhand_get_design_version' for the + # be 'deploy_site.get_design_version' for the # 'deckhand_get_design_version' task. We need to extract # the xcom value from it in order to get the value of the # last committed revision ID diff --git a/shipyard_airflow/plugins/deployment_configuration_operator.py b/shipyard_airflow/plugins/deployment_configuration_operator.py index 58bc5f9f..70c6b9f3 100644 --- a/shipyard_airflow/plugins/deployment_configuration_operator.py +++ b/shipyard_airflow/plugins/deployment_configuration_operator.py @@ -105,7 +105,7 @@ class DeploymentConfigurationOperator(BaseOperator): # Set the revision_id to the revision on the xcom revision_id = task_instance.xcom_pull( task_ids='deckhand_get_design_version', - dag_id=self.main_dag_name + '.deckhand_get_design_version') + dag_id=self.main_dag_name + '.get_design_version') if revision_id: LOG.info("Revision is set to: %s for deployment configuration", revision_id) diff --git a/shipyard_airflow/plugins/xcom_puller.py b/shipyard_airflow/plugins/xcom_puller.py index 5b3ddef9..e400fc66 100644 --- a/shipyard_airflow/plugins/xcom_puller.py +++ b/shipyard_airflow/plugins/xcom_puller.py @@ -77,7 +77,7 @@ class XcomPuller(object): def get_design_version(self): """Retrieve the design version being used for this workflow""" source_task = 'deckhand_get_design_version' - source_dag = 'deckhand_get_design_version' + source_dag = 'get_design_version' key = None return self._get_xcom(source_task=source_task, dag_id=source_dag,