Run workflow on multi-threaded worker cached with Sqlite3.

    :param workflow: workflow to evaluate.
    :param highlight: highlight these lines.
509708
def run_and_print_log(workflow, highlight=None):
    
    from noodles.run.threading.sqlite3 import run_parallel
    from noodles import serial

    import io
    import logging

    log = io.StringIO()
    log_handler = logging.StreamHandler(log)
    formatter = logging.Formatter('%(asctime)s - %(message)s')
    log_handler.setFormatter(formatter)

    logger = logging.getLogger('noodles')
    logger.setLevel(logging.INFO)
    logger.handlers = [log_handler]

    result = run_parallel(
        workflow, n_threads=4, registry=serial.base, db_file='tutorial.db',
        always_cache=True, echo_log=False)
    display_text(log.getvalue(), highlight or [], split_at=40)
    return result
294734
def _get_run_input(self, workflow_input, project=None, **kwargs):
        
        region = dxpy.api.project_describe(project,
                                           input_params={"fields": {"region": True}})["region"]
        dxworkflow = self.get_underlying_workflow(region)
        return dxworkflow._get_run_input(workflow_input, **kwargs)
1083150
public List<String> getRunningWorkflow(String workflowName, Integer version) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowName), "Workflow name cannot be blank");
        return getForEntity("workflow/running/{name}", new Object[]{"version", version}, new GenericType<List<String>>() {
        }, workflowName);
    }
357392
def execute_all(self):
        
        for workflow_id in self.workflows:
            if self.workflows[workflow_id].online:
                for interval in self.workflows[workflow_id].requested_intervals:
                    logging.info("Executing workflow {} over interval {}".format(workflow_id, interval))
                    self.workflows[workflow_id].execute(interval)
997627
def workflow(ctx, client):
    """"""
    if ctx.invoked_subcommand is None:
        from renku.models.refs import LinkReference

        names = defaultdict(list)
        for ref in LinkReference.iter_items(client, common_path='workflows'):
            names[ref.reference.name].append(ref.name)

        for path in client.workflow_path.glob('*.cwl'):
            click.echo(
                '{path}: {names}'.format(
                    path=path.name,
                    names=', '.join(
                        click.style(_deref(name), fg='green')
                        for name in names[path.name]
                    ),
                )
            )
79130
@Service
    public List<String> getRunningWorkflows(String workflowName, Integer version,
                                            Long startTime, Long endTime) {
        if (Optional.ofNullable(startTime).orElse(0l) != 0 && Optional.ofNullable(endTime).orElse(0l) != 0) {
            return workflowExecutor.getWorkflows(workflowName, version, startTime, endTime);
        } else {
            return workflowExecutor.getRunningWorkflowIds(workflowName);
        }
    }
1014654
def display_workflows(prefix, **kwargs):
    
    from IPython.display import display, Markdown

    def create_svg(name, workflow):
        """Create an SVG file with rendered graph from a workflow."""
        name = name.replace('_', '-')
        filename = '{}-{}.svg'.format(prefix, name)
        dot = get_workflow_graph(workflow)
        dot.attr('graph', bgcolor='transparent')
        with open(filename, 'bw') as file:
            file.write(dot.pipe(format='svg'))
        return name, filename

    svg_files = {name: svg for name, svg in
                 (create_svg(name, workflow)
                  for name, workflow in kwargs.items())}

    markdown_table = \
        '| ' + ' | '.join(svg_files.keys()) + ' |\n' + \
        '| ' + ' | '.join('---' for _ in svg_files) + ' |\n' + \
        '| ' + ' | '.join('![workflow {}]({})'.format(name, svg)
                          for name, svg in svg_files.items()) + ' |'
    display(Markdown(markdown_table))
287334
def run(self, files, working_area):
        

        # Ensure that dictionary is ordered by check declaration order (via self.check_names)
        # NOTE: Requires CPython 3.6. If we need to support older versions of Python, replace with OrderedDict.
        results = {name: None for name in self.check_names}
        checks_root = working_area.parent
        with futures.ProcessPoolExecutor() as executor:

            # Start all checks that have no dependencies
            not_done = set(executor.submit(run_check(name, self.checks_spec, checks_root))
                           for name, _ in self.child_map[None])
            not_passed = []

            while not_done:
                done, not_done = futures.wait(not_done, return_when=futures.FIRST_COMPLETED)
                for future in done:
                    # Get result from completed check
                    result, state = future.result()
                    results[result.name] = result
                    if result.passed:
                        # Dispatch dependent checks
                        for child_name, _ in self.child_map[result.name]:
                            not_done.add(executor.submit(
                                run_check(child_name, self.checks_spec, checks_root, state)))
                    else:
                        not_passed.append(result.name)

        for name in not_passed:
            self._skip_children(name, results)

        return results.values()
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)
470730
def work(druid)
      LyberCore::Log.set_logfile($stdout) # let process manager(bluepill) handle logging
      LyberCore::Log.info "#{druid} processing"
      return if @check_queued_status && !item_queued?(druid)

      result = nil
      elapsed = Benchmark.realtime do
        result = perform druid # implemented in the mixed-in robot class
      end

      # this is the default note to pass back to workflow service, but it can be overriden by a robot that uses the Lybercore::Robot::ReturnState object to return a status
      note = Socket.gethostname

      # the final workflow state is determined by the return value of the perform step, if it is a ReturnState object,
      # we will use the defined status, otherwise default to completed
      # if a note is passed back, we will also use that instead of the default
      if result.class == LyberCore::Robot::ReturnState
        workflow_state = result.status
        note = result.note unless result.note.blank?
      else
        workflow_state = 'completed'
      end

      # update the workflow status from its current state to the state returned by perform (or 'completed' as the default)
      workflow_service.update_workflow_status(@repo, druid, @workflow_name, @step_name, workflow_state, elapsed: elapsed, note: note)
      LyberCore::Log.info "Finished #{druid} in #{sprintf('%0.4f', elapsed)}s"
    rescue StandardError => e
      Honeybadger.notify(e) if defined? Honeybadger
      begin
        LyberCore::Log.error e.message + "\n" + e.backtrace.join("\n")
        workflow_service.update_workflow_error_status(@repo, druid, @workflow_name, @step_name, e.message, error_text: Socket.gethostname)
      rescue StandardError => e2
        LyberCore::Log.error "Cannot set #{druid} to status='error'\n" + e2.message + "\n" + e2.backtrace.join("\n")
        raise e2 # send exception to Resque failed queue
      end
    end
1307464
def tags
      runner.tag_lists[decision_task.workflow_execution] ||= begin
        collision = 0
        begin
          decision_task.workflow_execution.tags
        rescue => e
          collision += 1 if collision < 10
          max_slot_delay = 2**collision - 1
          sleep(slot_time * rand(0 .. max_slot_delay))
          retry
        end
      end
    end
610174
def run(self, definition):
        """"""
        self.logger.info("Running with Python %s", sys.version.replace("\n", ""))
        self.logger.info("Running on platform %s", platform.platform())
        self.logger.info("Current cpu count is %d", multiprocessing.cpu_count())
        self.logger.info("Processing pipeline definition '%s'", definition)

        document = self.validate_document(definition)
        if self.options.validate_only:
            self.logger.info("Stopping after validation as requested!")
            return []

        self.provide_temporary_scripts_path()

        versions = VersionsCheck().process(document)
        VersionsReport().process(versions)

        collector = Application.create_and_run_collector(document, self.options)
        matrix = find_matrix(document)
        output = []
        if len(matrix) == 0:
            model = {} if 'model' not in document else document['model']
            pipeline = Pipeline(model=model, options=self.options)
            pipeline.hooks = Hooks(document)
            result = pipeline.process(document['pipeline'])
        else:
            result = self.run_matrix(matrix, document)

        output = result['output']
        self.shutdown(collector, success=result['success'])
        return output
1161994
def run(self):
        
        from zengine.lib.cache import WFSpecNames

        if self.manager.args.clear:
            self._clear_models()
            return

        if self.manager.args.wf_path:
            paths = self.get_wf_from_path(self.manager.args.wf_path)
        else:
            paths = self.get_workflows()

        self.count = 0

        self.do_with_submit(self.load_diagram, paths, threads=self.manager.args.threads)

        WFSpecNames().refresh()

        print("%s BPMN file loaded" % self.count)
1205927
public void pauseWorkflow(String workflowId) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        stub.pauseWorkflow(WorkflowServicePb.PauseWorkflowRequest.newBuilder()
                .setWorkflowId(workflowId)
                .build()
        );
    }
38744
function(options) {
    var option = {enabled: true};
    option.text = Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;
    var name = this.getProcedureCall();
    var workspace = this.workspace;
    option.callback = function() {
      var def = Blockly.Procedures.getDefinition(name, workspace);
      def && def.select();
    };
    options.push(option);
  }
497420
public Workflow getWorkflow(String workflowId, boolean includeTasks) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        Workflow workflow = getForEntity("workflow/{workflowId}", new Object[]{"includeTasks", includeTasks}, Workflow.class, workflowId);
        populateWorkflowOutput(workflow);
        return workflow;
    }
48990
private void validateWorkflow(WorkflowDef workflowDef, Map<String, Object> workflowInput, String externalStoragePath) {
        try {
            //Check if the input to the workflow is not null
            if (workflowInput == null && StringUtils.isBlank(externalStoragePath)) {
                LOGGER.error("The input for the workflow '{}' cannot be NULL", workflowDef.getName());
                throw new ApplicationException(INVALID_INPUT, "NULL input passed when starting workflow");
            }
        } catch (Exception e) {
            Monitors.recordWorkflowStartError(workflowDef.getName(), WorkflowContext.get().getClientApp());
            throw e;
        }
    }