def __invoke(trans, workflow, workflow_run_config, workflow_invocation=None, populate_state=False):
 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:
   workflow_invocation.fail()
   trans.sa_session.add(workflow_invocation)
  else:
   raise
  outputs = []
 if workflow_invocation:
  trans.sa_session.flush()
 return (outputs, invoker.workflow_invocation)

def __invoke ( trans , workflow , workflow_run_config , workflow_invocation = None , populate_state = False ) : 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 : workflow_invocation . fail ( ) trans . sa_session . add ( workflow_invocation ) else : raise outputs = [ ] if workflow_invocation : trans . sa_session . flush ( ) return ( outputs , invoker . workflow_invocation )
run the supplied workflow in the supplied target_history .