Retrieve a workflow by workflow id

@param workflowId   the id of the workflow
@param includeTasks specify if the tasks in the workflow need to be returned
@return the requested workflow
967115
public Workflow getWorkflow(String workflowId, boolean includeTasks) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        WorkflowPb.Workflow workflow = stub.getWorkflowStatus(
                WorkflowServicePb.GetWorkflowStatusRequest.newBuilder()
                        .setWorkflowId(workflowId)
                        .setIncludeTasks(includeTasks)
                        .build()
        );
        return protoMapper.fromProto(workflow);
    }
989966
private String getLastWorkflowForUser() {

        CmsUser user = getCmsObject().getRequestContext().getCurrentUser();
        return (String)user.getAdditionalInfo(PARAM_WORKFLOW_ID);
    }
120913
@Override
  public List<Integer> getRunningFlows(final int projectId, final String flowId) {
    final List<Integer> executionIds = new ArrayList<>();
    try {
      executionIds.addAll(getRunningFlowsHelper(projectId, flowId,
          this.executorLoader.fetchUnfinishedFlows().values()));
    } catch (final ExecutorManagerException e) {
      logger.error("Failed to get running flows for project " + projectId + ", flow "
          + flowId, e);
    }
    return executionIds;
  }
1247448
public function getDefinitionByID($object, $workflowID)
    {
        // Make sure the correct extensions have been applied to the data object.

        $workflow = null;
        if ($object->hasExtension(WorkflowApplicable::class)
            || $object->hasExtension(FileWorkflowApplicable::class)
        ) {
            // Validate the workflow ID against the data object.

            if (($object->WorkflowDefinitionID == $workflowID)
                || ($workflow = $object->AdditionalWorkflowDefinitions()->byID($workflowID))
            ) {
                if (is_null($workflow)) {
                    $workflow = DataObject::get_by_id(WorkflowDefinition::class, $workflowID);
                }
            }
        }
        return $workflow ? $workflow : null;
    }
274913
@PUT
    @Path("/pause")
    @ApiOperation("Pause the list of workflows")
    public BulkResponse pauseWorkflow(List<String> workflowIds) {
        return workflowBulkService.pauseWorkflow(workflowIds);
    }
179016
@Service
    public void skipTaskFromWorkflow(String workflowId, String taskReferenceName,
                                     SkipTaskRequest skipTaskRequest) {
        workflowExecutor.skipTaskFromWorkflow(workflowId, taskReferenceName, skipTaskRequest);
    }
878610
public function getAllStatuses($workflowId)
	{
		$wDef = $this->getWorkflowDefinition($workflowId);
		if ( $wDef == null) {
			throw new WorkflowException('No workflow found with id ' . $workflowId);
		}
		$allStatuses = [];
		foreach( $wDef[self::KEY_NODES] as $statusId => $statusDef){
			$allStatuses[$statusId] = $this->getStatus($statusId);
		}
		return $allStatuses;
	}
687253
public static function get_included_tasks($restoreid) {
        $rc = restore_controller_dbops::load_controller($restoreid);
        $tasks = $rc->get_plan()->get_tasks();
        $includedtasks = array();
        foreach ($tasks as $key => $task) {
            // Calculate if the task is being included
            $included = false;
            // blocks, based in blocks setting and parent activity/course
            if ($task instanceof restore_block_task) {
                if (!$task->get_setting_value('blocks')) { // Blocks not included, continue
                    continue;
                }
                $parent = basename(dirname(dirname($task->get_taskbasepath())));
                if ($parent == 'course') { // Parent is course, always included if present
                    $included = true;

                } else { // Look for activity_included setting
                    $included = $task->get_setting_value($parent . '_included');
                }

            // ativities, based on included setting
            } else if ($task instanceof restore_activity_task) {
                $included = $task->get_setting_value('included');

            // sections, based on included setting
            } else if ($task instanceof restore_section_task) {
                $included = $task->get_setting_value('included');

            // course always included if present
            } else if ($task instanceof restore_course_task) {
                $included = true;
            }

            // If included, add it
            if ($included) {
                $includedtasks[] = clone($task); // A clone is enough. In fact we only need the basepath.
            }
        }
        $rc->destroy(); // Always need to destroy.

        return $includedtasks;
    }
196662
public AbstractJobVertex findVertexByID(final JobVertexID id) {

		if (this.inputVertices.containsKey(id)) {
			return this.inputVertices.get(id);
		}

		if (this.outputVertices.containsKey(id)) {
			return this.outputVertices.get(id);
		}

		if (this.taskVertices.containsKey(id)) {
			return this.taskVertices.get(id);
		}

		return null;
	}
289341
public List<TaskDetails> fetchTaskDetails(String cluster, String jobId,
      List<String> taskResponseFilters) throws IOException {
    String taskFilters = StringUtil.buildParam("include", taskResponseFilters);
    String urlString = String.format("http://%s/api/v1/tasks/%s/%s?%s",
        apiHostname, cluster, jobId, taskFilters);
    return retrieveTaskDetailsFromUrl(urlString);
  }
785806
public function getTaskServiceId($workflow, $taskName)
    {
        if (!isset($this->workflows[$workflow])) {
            $this->loadWorkflow($workflow);
        }

        return $this->workflows[$workflow]->getTask($taskName);
    }
860810
def find_workflow(workflow_name, custom_id)
      params = { ATTR_ID => custom_id, ATTR_NAME => workflow_name }
      params[ATTR_PROG] = PROG
      data = @http.get(instance_website_url(params))['data']
      data && @properties.object_from(
        data['name'],
        @serializer.decode(data['properties'])
      )
    rescue Zenaton::InternalError => exception
      return nil if exception.message =~ /No workflow instance found/
      raise exception
    end
753554
public void runDecider(String workflowId) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        stub.decideWorkflow(WorkflowServicePb.DecideWorkflowRequest.newBuilder()
                .setWorkflowId(workflowId)
                .build()
        );
    }
880345
private List<IWorkflow> splitWorkflowDispatchedSections(IWorkflow workflow) throws ExecutionServiceException {
        ArrayList<StepExecutionItem> dispatchItems = new ArrayList<>();
        ArrayList<IWorkflow> sections = new ArrayList<>();
        for (final StepExecutionItem item : workflow.getCommands()) {
            StepExecutor executor = getFramework().getStepExecutionService().getExecutorForItem(item);
            if (executor.isNodeDispatchStep(item)) {
                dispatchItems.add(item);
            } else {
                if (dispatchItems.size() > 0) {
                    //add workflow section
                    sections.add(new WorkflowImpl(dispatchItems,
                                                  workflow.getThreadcount(),
                                                  workflow.isKeepgoing(),
                                                  workflow.getStrategy()));
                    dispatchItems = new ArrayList<>();
                }

                sections.add(new WorkflowImpl(Collections.singletonList(item),
                                              workflow.getThreadcount(),
                                              workflow.isKeepgoing(),
                                              workflow.getStrategy()));
            }
        }
        if (null != dispatchItems && dispatchItems.size() > 0) {
            //add workflow section
            sections.add(new WorkflowImpl(dispatchItems,
                                          workflow.getThreadcount(),
                                          workflow.isKeepgoing(),
                                          workflow.getStrategy()));
        }
        return sections;
    }
634589
public WorkflowStrategy getStrategyForWorkflow(
            final WorkflowExecutionItem workflow,
            Map<String, Object> config,
            String projectName
    )
            throws ExecutionServiceException
    {

        String provider = workflow.getWorkflow().getStrategy();
        String s = builtinProviderSynonyms.get(provider);
        if (null != s) {
            provider = s;
        }
        WorkflowStrategy workflowStrategy = providerOfType(provider);
        if (null != config) {
            IRundeckProjectConfig iRundeckProjectConfig = framework.getFrameworkProjectMgr().loadProjectConfig(
                    projectName);

            PropertyResolver resolver = PropertyResolverFactory.createResolver(
                    config.size() > 0 ? PropertyResolverFactory.instanceRetriever(config) : null,
                    PropertyResolverFactory.instanceRetriever(
                            iRundeckProjectConfig.getProjectProperties()
                    ),
                    framework.getPropertyRetriever()
            );

            Description description = DescribableServiceUtil.descriptionForProvider(
                    true,
                    workflowStrategy
            );
            if (description != null) {
                PluginAdapterUtility.configureProperties(
                        resolver,
                        description,
                        workflowStrategy,
                        PropertyScope.Instance
                );
            }
        }
        return workflowStrategy;
    }
525795
def add_workflow(self, workflow, commit=False):
        
        if workflow.workflow_id in self.workflows:
            raise KeyError("Workflow with id {} already exists".format(workflow.workflow_id))

        self.workflows[workflow.workflow_id] = workflow
        logging.info("Added workflow {} to workflow manager".format(workflow.workflow_id))

        # Optionally also save the workflow to database
        if commit:
            self.commit_workflow(workflow.workflow_id)
        else:
            self.uncommitted_workflows.add(workflow.workflow_id)
1309364
def get_workflow(self):
        """"""
        extra_context = self.get_initial()
        entry_point = self.request.GET.get("step", None)
        workflow = self.workflow_class(self.request,
                                       context_seed=extra_context,
                                       entry_point=entry_point)
        return workflow