Esempio n. 1
0
def queue_invoke(trans, workflow, workflow_run_config, request_params=None, populate_state=True, flush=True):
    request_params = request_params or {}
    if populate_state:
        modules.populate_module_and_state(trans, workflow, workflow_run_config.param_map, allow_tool_state_corrections=workflow_run_config.allow_tool_state_corrections)
    workflow_invocation = workflow_run_config_to_request(trans, workflow_run_config, workflow)
    workflow_invocation.workflow = workflow
    return trans.app.workflow_scheduling_manager.queue(workflow_invocation, request_params, flush=flush)
Esempio n. 2
0
def queue_invoke( trans, workflow, workflow_run_config, request_params={}, populate_state=True ):
    if populate_state:
        modules.populate_module_and_state( trans, workflow, workflow_run_config.param_map, allow_tool_state_corrections=workflow_run_config.allow_tool_state_corrections )
    workflow_invocation = workflow_run_config_to_request( trans, workflow_run_config, workflow )
    workflow_invocation.workflow = workflow
    return trans.app.workflow_scheduling_manager.queue(
        workflow_invocation,
        request_params
    )
Esempio n. 3
0
def queue_invoke( trans, workflow, workflow_run_config, request_params={}, populate_state=True ):
    if populate_state:
        modules.populate_module_and_state( trans, workflow, workflow_run_config.param_map )
    workflow_invocation = workflow_run_config_to_request( trans, workflow_run_config, workflow )
    workflow_invocation.workflow = workflow
    return trans.app.workflow_scheduling_manager.queue(
        workflow_invocation,
        request_params
    )
Esempio n. 4
0
def invoke( trans, workflow, workflow_run_config, populate_state=False ):
    """ Run the supplied workflow in the supplied target_history.
    """
    if populate_state:
        modules.populate_module_and_state( trans, workflow, workflow_run_config.param_map )

    return WorkflowInvoker(
        trans,
        workflow,
        workflow_run_config,
    ).invoke()
Esempio n. 5
0
def __invoke(trans,
             workflow,
             workflow_run_config,
             workflow_invocation=None,
             populate_state=False):
    """ Run the supplied workflow in the supplied target_history.
    """
    if populate_state:
        modules.populate_module_and_state(
            trans,
            workflow,
            workflow_run_config.param_map,
            allow_tool_state_corrections=workflow_run_config.
            allow_tool_state_corrections)

    invoker = WorkflowInvoker(
        trans,
        workflow,
        workflow_run_config,
        workflow_invocation=workflow_invocation,
    )
    try:
        outputs = invoker.invoke()
    except modules.CancelWorkflowEvaluation:
        if workflow_invocation:
            if workflow_invocation.cancel():
                trans.sa_session.add(workflow_invocation)
        outputs = []
    except Exception:
        log.exception("Failed to execute scheduled workflow.")
        if workflow_invocation:
            # Running workflow invocation in background, just mark
            # persistent workflow invocation as failed.
            workflow_invocation.fail()
            trans.sa_session.add(workflow_invocation)
        else:
            # Running new transient workflow invocation in legacy
            # controller action - propage the exception up.
            raise
        outputs = []

    if workflow_invocation:
        # Be sure to update state of workflow_invocation.
        trans.sa_session.flush()

    return outputs, invoker.workflow_invocation
Esempio n. 6
0
def __invoke( trans, workflow, workflow_run_config, workflow_invocation=None, populate_state=False ):
    """ Run the supplied workflow in the supplied target_history.
    """
    if populate_state:
        modules.populate_module_and_state( trans, workflow, workflow_run_config.param_map, allow_tool_state_corrections=workflow_run_config.allow_tool_state_corrections )

    invoker = WorkflowInvoker(
        trans,
        workflow,
        workflow_run_config,
        workflow_invocation=workflow_invocation,
    )
    try:
        outputs = invoker.invoke()
    except modules.CancelWorkflowEvaluation:
        if workflow_invocation:
            if workflow_invocation.cancel():
                trans.sa_session.add( workflow_invocation )
        outputs = []
    except Exception:
        log.exception("Failed to execute scheduled workflow.")
        if workflow_invocation:
            # Running workflow invocation in background, just mark
            # persistent workflow invocation as failed.
            workflow_invocation.fail()
            trans.sa_session.add( workflow_invocation )
        else:
            # Running new transient workflow invocation in legacy
            # controller action - propage the exception up.
            raise
        outputs = []

    if workflow_invocation:
        # Be sure to update state of workflow_invocation.
        trans.sa_session.flush()

    return outputs, invoker.workflow_invocation