def test_validate_workflow_id(): """ static method validate_workflow_id """ assert WorkflowHelper.validate_workflow_id( 'aar__dvark__1924-04-12T05:34:01.222220' ) assert not WorkflowHelper.validate_workflow_id( 'aardvark_1924-04-12T05:34:01.222220' ) assert not WorkflowHelper.validate_workflow_id( None )
def get_workflow_detail(self, helper, workflow_id): """ Retrieve a workflow by id, :param helper: The WorkflowHelper constructed for this invocation :param workflow_id: a string in {dag_id}__{execution_date} format identifying a workflow :returns: a workflow detail dictionary including steps """ if not WorkflowHelper.validate_workflow_id(workflow_id): raise ApiError( title='Invalid Workflow ID specified', description=( 'Workflow id must use {dag id}__{execution date} format', ), status=falcon.HTTP_400, retry=False, ) workflow = helper.get_workflow(workflow_id=workflow_id) if workflow is None: raise ApiError( title='Workflow not found', description=('A Workflow with id {} was not found'.format( workflow_id), ), status=falcon.HTTP_404, retry=False, ) return workflow