def execute_system_workflow(wf_id, task_id, task_mapping, deployment=None,
                                execution_parameters=None):
        # task_id is not generated here since for system workflows,
        # the task id is equivalent to the execution id

        task_queue = 'cloudify.management'
        context = {
            'task_id': task_id,
            'task_name': task_mapping,
            'execution_id': task_id,
            'workflow_id': wf_id,
        }

        if deployment:
            context['blueprint_id'] = deployment.blueprint_id
            context['deployment_id'] = deployment.id

        context['task_target'] = task_queue

        if execution_parameters is None:
            execution_parameters = {}
        execution_parameters['__cloudify_context'] = context

        return client().execute_task(
            context['task_name'],
            task_queue,
            context['task_id'],
            kwargs=execution_parameters
        )
    def execute_workflow(name,
                         workflow,
                         blueprint_id,
                         deployment_id,
                         execution_id,
                         execution_parameters=None):
        task_name = workflow['operation']
        task_queue = '{}_workflows'.format(deployment_id)

        execution_parameters['__cloudify_context'] = {
            'workflow_id': name,
            'blueprint_id': blueprint_id,
            'deployment_id': deployment_id,
            'execution_id': execution_id
        }

        client().execute_task(task_name=task_name,
                              task_queue=task_queue,
                              task_id=execution_id,
                              kwargs=execution_parameters)
Esempio n. 3
0
    def execute_workflow(name,
                         workflow,
                         blueprint_id,
                         deployment_id,
                         execution_id,
                         execution_parameters=None):
        task_name = workflow['operation']
        task_queue = '{}_workflows'.format(deployment_id)

        execution_parameters['__cloudify_context'] = {
            'workflow_id': name,
            'blueprint_id': blueprint_id,
            'deployment_id': deployment_id,
            'execution_id': execution_id
        }

        client().execute_task(task_name=task_name,
                              task_queue=task_queue,
                              task_id=execution_id,
                              kwargs=execution_parameters)
    def execute_system_workflow(deployment, wf_id, task_id, task_mapping,
                                execution_parameters=None):
        # task_id is not generated here since for system workflows,
        # the task id is equivalent to the execution id

        task_queue = 'cloudify.management'

        context = {
            'task_id': task_id,
            'task_name': task_mapping,
            'task_target': task_queue,
            'blueprint_id': deployment.blueprint_id,
            'deployment_id': deployment.id,
            'execution_id': task_id,
            'workflow_id': wf_id,
        }
        execution_parameters = execution_parameters or {}
        execution_parameters['__cloudify_context'] = context

        return client().execute_task(
            task_mapping,
            task_queue,
            task_id,
            kwargs=execution_parameters)