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
This commit is contained in:
Anthony Lin 2018-04-13 08:00:02 +00:00 committed by Bryan Strassner
parent 80fc8095ae
commit f8fb44b7a0
5 changed files with 7 additions and 7 deletions

View File

@ -88,7 +88,7 @@ class CommonStepFactory(object):
on_failure_callback=step_failure_handler, on_failure_callback=step_failure_handler,
dag=self.dag) 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 """Generate the get design version step
Retrieves the version of the design to use from deckhand Retrieves the version of the design to use from deckhand

View File

@ -16,7 +16,7 @@
ALL_PREFLIGHT_CHECKS_DAG_NAME = 'preflight' ALL_PREFLIGHT_CHECKS_DAG_NAME = 'preflight'
ARMADA_BUILD_DAG_NAME = 'armada_build' ARMADA_BUILD_DAG_NAME = 'armada_build'
DAG_CONCURRENCY_CHECK_DAG_NAME = 'dag_concurrency_check' 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' GET_DEPLOY_CONF_DAG_NAME = 'dag_deployment_configuration'
DRYDOCK_BUILD_DAG_NAME = 'drydock_build' DRYDOCK_BUILD_DAG_NAME = 'drydock_build'
VALIDATE_SITE_DESIGN_DAG_NAME = 'validate_site_design' VALIDATE_SITE_DESIGN_DAG_NAME = 'validate_site_design'

View File

@ -94,8 +94,8 @@ class DeckhandBaseOperator(BaseOperator):
self.do_execute() self.do_execute()
# Push last committed version to xcom for the # Push last committed version to xcom for the
# 'deckhand_get_design_version' subdag # 'get_design_version' subdag
if self.sub_dag_name == 'deckhand_get_design_version': if self.sub_dag_name == 'get_design_version':
return self.committed_ver return self.committed_ver
@shipyard_service_token @shipyard_service_token
@ -145,7 +145,7 @@ class DeckhandBaseOperator(BaseOperator):
# 'deckhand_get_design_version' # 'deckhand_get_design_version'
# #
# NOTE: In the case of 'deploy_site', the dag_id will # 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 # 'deckhand_get_design_version' task. We need to extract
# the xcom value from it in order to get the value of the # the xcom value from it in order to get the value of the
# last committed revision ID # last committed revision ID

View File

@ -105,7 +105,7 @@ class DeploymentConfigurationOperator(BaseOperator):
# Set the revision_id to the revision on the xcom # Set the revision_id to the revision on the xcom
revision_id = task_instance.xcom_pull( revision_id = task_instance.xcom_pull(
task_ids='deckhand_get_design_version', 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: if revision_id:
LOG.info("Revision is set to: %s for deployment configuration", LOG.info("Revision is set to: %s for deployment configuration",
revision_id) revision_id)

View File

@ -77,7 +77,7 @@ class XcomPuller(object):
def get_design_version(self): def get_design_version(self):
"""Retrieve the design version being used for this workflow""" """Retrieve the design version being used for this workflow"""
source_task = 'deckhand_get_design_version' source_task = 'deckhand_get_design_version'
source_dag = 'deckhand_get_design_version' source_dag = 'get_design_version'
key = None key = None
return self._get_xcom(source_task=source_task, return self._get_xcom(source_task=source_task,
dag_id=source_dag, dag_id=source_dag,