Performs the workflow transition passed in and returns the list of
        objects that have been successfully transitioned
512848
def do_action(self, action, objects):
        
        transitioned = []
        ActionHandlerPool.get_instance().queue_pool()
        for obj in objects:
            obj = api.get_object(obj)
            success, message = do_action_for(obj, action)
            if success:
                transitioned.append(obj)
        ActionHandlerPool.get_instance().resume()
        return transitioned
199624
def sample_transitions(self, batch_size, batch_info, discount_factor=None) -> Transitions:
        
        indexes = self.backend.sample_batch_transitions(batch_size)
        transition_tensors = self.backend.get_transitions(indexes)

        return Trajectories(
            num_steps=batch_size,
            num_envs=self.backend.num_envs,
            environment_information=None,
            transition_tensors={k: torch.from_numpy(v) for k, v in transition_tensors.items()},
            rollout_tensors={}
        ).to_transitions()
572873
def _find_workflows(mcs, attrs):
        
        workflows = {}
        for k, v in attrs.items():
            if isinstance(v, StateField):
                workflows[k] = v
        return workflows
434550
public function iSaveWorkflow()
	{
		$locator = '#workflowSettings-buttons-submit';
		$element = $this->minkContext->getSession()->getPage()->find('css',$locator);
		$element->click();
	}
11995
def transitions(self):
        """"""
        if self._transitions is not None:
            return self._transitions
        transitions = self.array.astype(np.float)
        transitions /= transitions.sum(1)[:, np.newaxis]
        self._transitions = transitions
        return transitions
227806
def workflow_start(obj, queue, keep_data, name, workflow_args):
    
    try:
        start_workflow(name=name,
                       config=obj['config'],
                       queue=queue,
                       clear_data_store=not keep_data,
                       store_args=dict([arg.split('=', maxsplit=1)
                                        for arg in workflow_args]))
    except (WorkflowArgumentError, WorkflowImportError) as e:
        click.echo(_style(obj['show_color'],
                          'An error occurred when trying to start the workflow',
                          fg='red', bold=True))
        click.echo('{}'.format(e))
    except WorkflowDefinitionError as e:
        click.echo(_style(obj['show_color'],
                          'The graph {} in workflow {} is not a directed acyclic graph'.
                          format(e.graph_name, e.workflow_name), fg='red', bold=True))
145746
def get_trajectories(self, index, rollout_length, history_length):
        
        indexes = np.arange(index - rollout_length + 1, index + 1, dtype=int)
        return self.get_transitions(indexes, history_length)
979445
def after_processing(eng, objects):
        """"""
        super(InvenioProcessingFactory, InvenioProcessingFactory)\
            .after_processing(eng, objects)
        if eng.has_completed:
            eng.save(WorkflowStatus.COMPLETED)
        else:
            eng.save(WorkflowStatus.HALTED)
        db.session.commit()
978414
protected boolean isAsyncTransitionInstance(TransitionInstance transitionInstance) {
    String executionId = transitionInstance.getExecutionId();
    ExecutionEntity execution = Context.getCommandContext().getExecutionManager().findExecutionById(executionId);
    for (JobEntity job : execution.getJobs()) {
      if (AsyncContinuationJobHandler.TYPE.equals(job.getJobHandlerType())) {
        return true;
      }
    }

    return false;
  }
816616
public function performTransition(WorkflowTransition $transition)
    {
        // first make sure that the transition is valid to execute!
        $action          = $this->CurrentAction();
        $allTransitions  = $action->BaseAction()->Transitions();

        $valid = $allTransitions->find('ID', $transition->ID);
        if (!$valid) {
            throw new Exception(
                sprintf(_t(
                    'WorkflowInstance.WORKFLOW_TRANSITION_EXCEPTION',
                    'Invalid transition state for action #%s'
                ), $action->ID)
            );
        }

        $action->actionComplete($transition);

        $definition = DataObject::get_by_id(WorkflowAction::class, $transition->NextActionID);
        $action = $definition->getInstanceForWorkflow();
        $action->WorkflowID   = $this->ID;
        $action->write();

        $this->CurrentActionID = $action->ID;
        $this->write();
        $this->components = array(); // manually clear the has_one cache

        $action->actionStart($transition);

        $transition->extend('onTransition');
        $this->execute();
    }
1173435
def list_crawler_workflows(tail):
    """"""
    query = (
        models.CrawlerWorkflowObject.query
        .order_by(models.CrawlerWorkflowObject.object_id.desc())
    )
    if tail != 0:
        query = query.limit(tail)

    workflows = query.yield_per(10).all()
    _show_table(results=workflows)
31750
def completed_work_items(self):
        ""
        completed = self._conn.execute(
            "SELECT * FROM work_items, results WHERE work_items.job_id == results.job_id"
        )
        return ((_row_to_work_item(result), _row_to_work_result(result))
                for result in completed)
1051514
def transitions(accountable):
    
    transitions = accountable.issue_transitions().get('transitions')
    headers = ['id', 'name']
    if transitions:
        rows = [[v for k, v in sorted(t.items()) if k in headers]
                for t in transitions]
        rows.insert(0, headers)
        print_table(SingleTable(rows))
    else:
        click.secho(
            'No transitions found for {}'.format(accountable.issue_key),
            fg='red'
        )
1326665
def get_workflows():
    
    wftool = api.get_tool("portal_workflow")
    wfs = {}
    for wfid in wftool.objectIds():
        wf = wftool.getWorkflowById(wfid)
        if hasattr(aq_base(wf), "updateRoleMappingsFor"):
            wfs[wfid] = wf
    return wfs
737214
public function onAfterDelete()
    {
        parent::onAfterDelete();
        $wfActionInstances = WorkflowActionInstance::get()
            /** @skipUpgrade */
            ->leftJoin('WorkflowInstance', '"WorkflowInstance"."ID" = "WorkflowActionInstance"."WorkflowID"')
            ->where(sprintf('"BaseActionID" = %d AND ("WorkflowStatus" IN (\'Active\',\'Paused\'))', $this->ID));
        foreach ($wfActionInstances as $wfActionInstance) {
            $wfInstances = WorkflowInstance::get()->filter('CurrentActionID', $wfActionInstance->ID);
            foreach ($wfInstances as $wfInstance) {
                $wfInstance->Groups()->removeAll();
                $wfInstance->Users()->removeAll();
                $wfInstance->delete();
            }
            $wfActionInstance->delete();
        }
        // Delete outbound transitions
        $transitions = WorkflowTransition::get()->filter('ActionID', $this->ID);
        foreach ($transitions as $transition) {
            $transition->Groups()->removeAll();
            $transition->Users()->removeAll();
            $transition->delete();
        }
    }
1283999
def _find_workflows(mcs, attrs):
        
        workflows = {}
        for attribute, value in attrs.items():
            if isinstance(value, Workflow):
                workflows[attribute] = StateField(value)
        return workflows
48341
def _get_transitions(self, probs, indexes, tree_idxs, batch_info, forward_steps=1, discount_factor=1.0):
        
        if forward_steps > 1:
            transition_arrays = self.backend.get_transitions_forward_steps(indexes, forward_steps, discount_factor)
        else:
            transition_arrays = self.backend.get_transitions(indexes)

        priority_weight = self.priority_weight.value(batch_info['progress'])

        # Normalize by sum of all probs
        probs = probs / np.array([s.total() for s in self.backend.segment_trees], dtype=float).reshape(1, -1)
        capacity = self.backend.current_size
        weights = (capacity * probs) ** (-priority_weight)
        weights = weights / weights.max(axis=0, keepdims=True)

        transition_arrays['weights'] = weights
        transition_tensors = {k: torch.from_numpy(v) for k, v in transition_arrays.items()}

        transitions = Trajectories(
            num_steps=indexes.shape[0],
            num_envs=indexes.shape[1],
            environment_information=None,
            transition_tensors=transition_tensors,
            rollout_tensors={},
            extra_data={
                'tree_idxs': tree_idxs
            }
        )

        return transitions.to_transitions()