Rerun current job
519554
protected function rerun() {

        $rerunNextStep = empty($this->data['rerunStep']) ? 1 : intval($this->data['rerunStep']) + 1;

        if($rerunNextStep <= $this->maxStepOfRerun) {
            JobFabric::getInstance()->createJob(
                (new TypedBuilder())
                    ->setType($this->type)
                    ->setData($this->data)
                    ->setRerunStep($rerunNextStep)
                    ->setStart(time() + $this->getFibonacciDelay($rerunNextStep))
                    ->setOriginal($this->_id)
            );
        }
    }
997100
private void runJobLauncherLoop() throws JobException {
    try {
      while (true) {
        currentJobLauncher = this.jobScheduler.buildJobLauncher(jobProps);
        // in "run once" case, job scheduler will remove current job from the scheduler
        boolean isEarlyStopped = this.jobScheduler.runJob(jobProps, jobListener, currentJobLauncher);
        boolean isRetriggerEnabled = this.isRetriggeringEnabled();
        if (isEarlyStopped && isRetriggerEnabled) {
          log.info("Job {} will be re-triggered.", jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY));
        } else {
          break;
        }
        currentJobLauncher = null;
      }
    } catch (Exception e) {
      log.error("Failed to run job {}", jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
      throw new JobException("Failed to run job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
    }
  }
788337
def refresh(self, reloadData=False, force=False):
        
        if not (self.isVisible() or force):
            self._refreshTimer.start()
            return
        
        if self.isLoading():
            return
        
        if reloadData:
            self.refreshQueryRecords()
        
        # cancel current work
        self._refreshTimer.stop()
        self.worker().cancel()
        
        if self._popup:
            self._popup.close()
        
        # grab the record set
        currset = self.currentRecordSet()
        
        self.worker().setBatched(self.isPaged())
        self.worker().setBatchSize(self.pageSize())
        
        # group the information
        if self._searchTerms:
            currset.setGroupBy(None)
            pageSize = 0
        
        # work with groups
        elif self.groupBy() and self.isGroupingActive():
            currset.setGroupBy(self.groupBy())
        
        # work with batching
        else:
            currset.setGroupBy(None)
        
        # order the information
        if self.order():
            currset.setOrdered(True)
            currset.setOrder(self.order())
        
        # for larger queries, run it through the thread
        if self.useLoader():
            loader = XLoaderWidget.start(self)
        
        # specify the columns to load
        if self.specifiedColumnsOnly():
            currset.setColumns(map(lambda x: x.name(),
                                   self.specifiedColumns()))
        
        self._loadedColumns = set(self.visibleColumns())
        
        if self.isThreadEnabled() and currset.isThreadEnabled():
            self.worker().setPreloadColumns(self._preloadColumns)
            self.loadRequested.emit(currset)
        else:
            QApplication.setOverrideCursor(Qt.WaitCursor)
            self.worker().loadRecords(currset)
            QApplication.restoreOverrideCursor()
664702
def run_jobs(delete_completed=False, ignore_errors=False, now=None):
    
    if ScheduledJob.objects.filter(status='running'):
        raise ValueError('jobs in progress found; aborting')
    if now is None:
        now = datetime.datetime.now()

    expire_jobs(now)
    schedule_sticky_jobs()
    start_scheduled_jobs(now, delete_completed, ignore_errors)
1323070
def run_next(self):
        
        while 1:
            (op, obj) = self.work_queue.get()
            if op is STOP_SIGNAL:
                return
            try:
                (job_id, command_line) = obj
                try:
                    os.remove(self._job_file(job_id, JOB_FILE_COMMAND_LINE))
                except Exception:
                    log.exception("Running command but failed to delete - command may rerun on Pulsar boot.")
                # _run will not do anything if job has been cancelled.
                self._run(job_id, command_line, background=False)
            except Exception:
                log.warn("Uncaught exception running job with job_id %s" % job_id)
                traceback.print_exc()
1077701
def refresh(self):
    """"""
    if self.status == 'executing' and self.array:
      new_result = 0
      for array_job in self.array:
        if array_job.status == 'failure' and new_result is not None:
          new_result = array_job.result
        elif array_job.status not in ('success', 'failure'):
          new_result = None
      if new_result is not None:
        self.status = 'success' if new_result == 0 else 'failure'
        self.result = new_result
350193
def run2(job_haz, job_risk, calc_id, concurrent_tasks, pdb, loglevel,
         exports, params):
    
    hcalc = base.calculators(readinput.get_oqparam(job_haz), calc_id)
    hcalc.run(concurrent_tasks=concurrent_tasks, pdb=pdb,
              exports=exports, **params)
    hc_id = hcalc.datastore.calc_id
    rcalc_id = logs.init(level=getattr(logging, loglevel.upper()))
    oq = readinput.get_oqparam(job_risk, hc_id=hc_id)
    rcalc = base.calculators(oq, rcalc_id)
    rcalc.run(pdb=pdb, exports=exports, **params)
    return rcalc
934823
private void reorderJobs(JobInProgress job, JobSchedulingInfo oldInfo, 
                           QueueInfo qi) {
    
    if(qi.removeWaitingJob(oldInfo) != null) {
      qi.addWaitingJob(job);
    }
    if(qi.removeRunningJob(oldInfo) != null) {
      qi.addRunningJob(job);
    }
  }
1190820
def run_job(self, id, jobstore=None):
        
        job = self._scheduler.get_job(id, jobstore)

        if not job:
            raise JobLookupError(id)

        job.func(*job.args, **job.kwargs)
863220
private void scheduleRenewalThresholdUpdateTask() {
        timer.schedule(new TimerTask() {
                           @Override
                           public void run() {
                               updateRenewalThreshold();
                           }
                       }, serverConfig.getRenewalThresholdUpdateIntervalMs(),
                serverConfig.getRenewalThresholdUpdateIntervalMs());
    }
754892
def rerun(client, revision, roots, siblings, inputs, paths):
    """"""
    graph = Graph(client)
    outputs = graph.build(paths=paths, revision=revision)

    # Check or extend siblings of outputs.
    outputs = siblings(graph, outputs)
    output_paths = {node.path for node in outputs}

    # Normalize and check all starting paths.
    roots = {graph.normalize_path(root) for root in roots}
    assert not roots & output_paths, '--from colides with output paths'

    # Generate workflow and check inputs.
    # NOTE The workflow creation is done before opening a new file.
    workflow = inputs(
        client,
        graph.ascwl(
            input_paths=roots,
            output_paths=output_paths,
            outputs=outputs,
        )
    )

    # Make sure all inputs are pulled from a storage.
    client.pull_paths_from_storage(
        *(path for _, path in workflow.iter_input_files(client.workflow_path))
    )

    # Store the generated workflow used for updating paths.
    import yaml

    output_file = client.workflow_path / '{0}.cwl'.format(uuid.uuid4().hex)
    with output_file.open('w') as f:
        f.write(
            yaml.dump(
                ascwl(
                    workflow,
                    filter=lambda _, x: x is not None,
                    basedir=client.workflow_path,
                ),
                default_flow_style=False
            )
        )

    # Execute the workflow and relocate all output files.
    from ._cwl import execute
    # FIXME get new output paths for edited tools
    # output_paths = {path for _, path in workflow.iter_output_files()}
    execute(
        client,
        output_file,
        output_paths=output_paths,
    )
1294355
public synchronized void runNow(String scheduledJobId) {
    ScheduledJob scheduledJob = getJob(scheduledJobId);

    try {
      JobKey jobKey = new JobKey(scheduledJobId, SCHEDULED_JOB_GROUP);
      if (quartzScheduler.checkExists(jobKey)) {
        // Run job now
        quartzScheduler.triggerJob(jobKey);
      } else {
        // Schedule with 'now' trigger
        Trigger trigger =
            newTrigger().withIdentity(scheduledJobId, SCHEDULED_JOB_GROUP).startNow().build();
        schedule(scheduledJob, trigger);
      }
    } catch (SchedulerException e) {
      LOG.error("Error runNow ScheduledJob", e);
      throw new MolgenisDataException("Error job runNow", e);
    }
  }
859454
def requeue(rq, ctx, all, job_ids):
    ""
    return ctx.invoke(
        rq_cli.requeue,
        all=all,
        job_ids=job_ids,
        **shared_options(rq)
    )
539353
def run_with_retry(&block)
      Log.debug "Running job '#{@job_id}' with status '#{@status}'"
      # If we are not the first job in this group, wait @delay
      ChimpDaemon.instance.semaphore.synchronize do
        if @group.started >= @concurrency && @delay.nonzero?
          Log.info "[#{@job_uuid}] Sleeping #{@delay} seconds between tasks"
          sleep @delay
        end
        @group.started += 1
      end

      @status = STATUS_RUNNING
      @time_start = Time.now

      Log.info self.describe_work_start unless @quiet

      #
      # The inner level of exception handling here tries to catch anything
      # that can be easily retired or failed-- normal exceptions.
      #
      # The outer level of exception handling handles weird stuff; for example,
      # sometimes rest_connection raises RuntimeError exceptions...
      #
      # This fixes acu75562.
      #
      begin
        begin
          yield if not @dry_run

          if @owner != nil
            @status = STATUS_DONE
            @group.job_completed
          else
            Log.warn "[#{@job_uuid}][#{@job_id}] Ownership of job_id #{job_id} lost. User cancelled operation?"
          end

        rescue SystemExit, Interrupt => ex
          $stderr.puts 'Exiting!'
          raise ex

        rescue Interrupt => ex
          name = @array['name'] if @array
          name = @server['name'] || @server['nickname'] if @server
          Log.error self.describe_work_error

          if @retry_count > 0
            @status = STATUS_RETRYING
            Log.error "[#{@job_uuid}][#{@job_id}] Error executing on \"#{name}\". Retrying in #{@retry_sleep} seconds..."
            @retry_count -= 1
            sleep @retry_sleep
            retry
          end

          @status = STATUS_ERROR
          @error = ex
          Log.error "[#{@job_uuid}][#{@job_id}] Error executing on \"#{name}\": #{ex}"

        ensure
          @time_end = Time.now
          Log.info self.describe_work_done unless @quiet
        end

      rescue RuntimeError => ex
        err = ex.message + "IP: #{@server.params["ip_address"]}\n" if @server.params['ip_address']
        err += " Group: #{@group.group_id}\n" if @group.group_id
        err += " Notes: #{@job_notes}\n" if @job_notes
        err += " Notes: #{@job_notes}\n" if @job_notes
        Log.error "[#{@job_uuid}][#{@job_id}] Caught RuntimeError: #{err} Job failed.\n"
        @status = STATUS_ERROR
        @error = ex
      end
    end
1374004
def rerun(version="3.7.0"):
    
    from commandlib import Command

    Command(DIR.gen.joinpath("py{0}".format(version), "bin", "python"))(
        DIR.gen.joinpath("state", "examplepythoncode.py")
    ).in_dir(DIR.gen.joinpath("state")).run()
585851
@Override
	public void run() {
		long currentTime = timeProvider.currentTime();
		for(Job job : scheduler.jobStatus()) {
			cleanUpLongJobIfItHasFinishedExecuting(currentTime, job);
			detectLongRunningJob(currentTime, job);
		}
	}
711420
def run(self):
    """"""
    while True:
      try:
        self._poll_for_update()
      except RuntimeError as error:
        # Note that because logging triggers a call to notify_update(), by
        # logging a message, we automatically retry publishing the update
        # after an error occurs.
        if error.message == 'dictionary changed size during iteration':
          # These errors occur occasionally and it is infeasible to get rid of
          # them entirely unless data.convert_to_base_types() is made
          # thread-safe. Ignore the error and retry quickly.
          _LOG.debug('Ignoring (probably harmless) error in station watcher: '
                     '`dictionary changed size during iteration`.')
          time.sleep(0.1)
        else:
          _LOG.exception('Error in station watcher: %s', error)
          time.sleep(1)
      except Exception as error:  # pylint: disable=broad-except
        _LOG.exception('Error in station watcher: %s', error)
        time.sleep(1)