Resume a job, all jobs, or multiple jobs.

@param string|array|int|null $jobsToResume Setting this value to null implies 'all jobs'
@return boolean
769422
public function resumeJob($jobsToResume = null)
    {
		$url = $this->service_url . '/jobs/resume';
        $body = json_encode(array("jobId" => (array) $jobsToResume));
        return $this->service->prepAndSend($url, array(200), 'POST', $body, false, 'application/json', 'application/json');
	}
985235
protected function doResumeTrigger(Key $triggerKey)
    {
        if (false == $trigger = $this->retrieveTrigger($triggerKey)) {
            return;
        }

        if (false == $trigger->getNextFireTime()) {
            return;
        }

        $misfired = false;
        if (((int) $trigger->getNextFireTime()->format('U')) < time()) {
            $misfired = $this->updateMisfiredTrigger($triggerKey, Trigger::STATE_WAITING);
        }

        if (false == $misfired) {
            $trigger->setState(Trigger::STATE_WAITING);
            $result = $this->res->getTriggerStorage()->update($trigger);

            if (false == $result->isAcknowledged() || false == $result->getModifiedCount()) {
                throw new JobPersistenceException(sprintf('Couldn\'t resume trigger: "%s"', $triggerKey));
            }
        }
    }
536999
public function resume()
    {
        if ($this->started === false && $this->canBeResumed()) {
            $this->started = true;

            $sessionObjects = $this->storageCache->get($this->storageIdentifier . md5('Neos_Flow_Object_ObjectManager'));
            if (is_array($sessionObjects)) {
                foreach ($sessionObjects as $object) {
                    if ($object instanceof ProxyInterface) {
                        $objectName = $this->objectManager->getObjectNameByClassName(get_class($object));
                        if ($this->objectManager->getScope($objectName) === ObjectConfiguration::SCOPE_SESSION) {
                            $this->objectManager->setInstance($objectName, $object);
                            $this->objectManager->get(Aspect\LazyLoadingAspect::class)->registerSessionInstance($objectName, $object);
                        }
                    }
                }
            } else {
                // Fallback for some malformed session data, if it is no array but something else.
                // In this case, we reset all session objects (graceful degradation).
                $this->storageCache->set($this->storageIdentifier . md5('Neos_Flow_Object_ObjectManager'), [], [$this->storageIdentifier], 0);
            }

            $lastActivitySecondsAgo = ($this->now - $this->lastActivityTimestamp);
            $this->lastActivityTimestamp = $this->now;
            return $lastActivitySecondsAgo;
        }
    }
1299990
public function pop($queue)
    {
        //migrate the retry jobs
        $this->migrateRetryJobs($queue);

        $data = $this->client->lpop($this->getQueueNameWithPrefix($queue));

        if (!empty($data)) {
            $job = @unserialize($data);
            if ($job instanceof AbstractJob) {
                return $job;
            }
        }

        return null;
    }
669385
public static void resume(Transaction transaction)
   {
      try {
         transactionManager.resume(transaction);
      }
      catch (Exception e) {
         throw new RuntimeException("Unable to resume transaction", e);
      }
   }
381773
@Override
    public void resumeConsumer(int suspendFlag)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "resumeConsumer", this);

        // Use this flag to identify whether a new thread must be spun off to look for more
        // messages
        boolean spinOffNewThread = false;
        try
        {
            // Take the lock
            this.lock();

            if (_consumerSuspended)
            {
                boolean setStillSuspended = false;

                // If we're resuming due to the ConsumerSet being resumed then we need to
                // re-check the set's state due to us not holding the set's activeMessageCount
                // lock at this time (due to the hierarchy). And if we find that the set is
                // actually suspended (due to someone else in the set getting in and adding
                // another message then we just ignore this resume as there'll be another one
                // along when the count drops back below the limit again.
                if (suspendFlag == DispatchableConsumerPoint.SUSPEND_FLAG_SET_ACTIVE_MSGS)
                    setStillSuspended = _consumerKey.isConsumerSetSuspended();

                if (!setStillSuspended)
                {
                    // clear the bit provided in the _suspendFlags
                    _suspendFlags &= ~suspendFlag;

                    if (_suspendFlags == 0) // No flags set so resume the consumer
                    {
                        _consumerSuspended = false;

                        // If the consumer is still active (started) we need
                        // to kickstart the consumer back into life to check for more
                        // messages
                        if (!_stopped && !_closing)
                        {
                            if (_asynchConsumerRegistered)
                            {
                                if (!_asynchConsumer.isAsynchConsumerRunning())
                                {
                                    // We'll have to take the full lock hierarchy and
                                    // possibly spin off another thread to start looking for more messages
                                    // (just like start())
                                    spinOffNewThread = true;
                                }
                            }
                            else
                            {
                                // Wake up any synchronous receivers
                                _waiter.signal();
                            }
                        }
                    }
                }
            }
        } finally
        {
            this.unlock();
        }

        // start a new thread to run the callback if we determined that it was necessary   
        if (spinOffNewThread)
        {
            try
            {
                _messageProcessor.startNewThread(new AsynchThread(this, false));
            } catch (InterruptedException e)
            {
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.JSLocalConsumerPoint.resumeConsumer",
                                            "1:4978:1.22.5.1",
                                            this);

                SibTr.exception(tc, e);

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "resumeConsumer", e);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "resumeConsumer");
    }
229136
public void resume(@NonNull ProfileManagerSubscriber subscriber) {
        profileModifier.resume(subscriber);
        profileChecker.resume(subscriber);
    }
904795
public function getJobs($limit = null)
    {
        $select = $this->getAdapter()->select();
        $select->from($this->jobTable)
               ->where("$this->jobStatusColumn = ?", JobInterface::STATUS_ACTIVE)
               ->order(array("$this->jobPriorityColumn DESC", "$this->jobDateLastRunColumn ASC"));
        
        if ($limit !== null) {
            $select->limit($limit);
        }
        
        $jobs = array();
        foreach ($select->query()->fetchAll() as $result) {
            $job = $this->createJobRowObject($result);
            $jobs[] = $job;
        }

        return $jobs;
    }
324846
public function isCanceledJob($job_model)
    {
        $cancel_job_id = $this->getQuery('cancel_job');

        if (empty($cancel_job_id)) {
            return false;
        }

        $job_model->delete($cancel_job_id);
        return true;
    }
343887
public function reset($queue)
    {
        if (!function_exists('posix_getsid')) {
            throw JobConfigurationException::create('Function posix_getsid don\'t exists');
        }

        $configurations = $this->configurationManager->findPotentialDeadJobs($queue);

        foreach ($configurations as $configuration) {
            if ($this->restoreManager->reset($configuration)) {
                return true;
            }
        }

        return false;
    }
64743
private function createJobCollection(ReflectionClass $reflectionClass, Reader $reader)
    {
        $jobCollection = new JobCollection;

        /**
         * For each defined method, we parse it
         */
        foreach ($reflectionClass->getMethods() as $reflectionMethod) {

            $methodAnnotations = $reader->getMethodAnnotations($reflectionMethod);

            /**
             * Every annotation found is parsed
             */
            foreach ($methodAnnotations as $methodAnnotation) {

                /**
                 * Annotation is only loaded if is typeof JobAnnotation
                 */
                if ($methodAnnotation instanceof JobAnnotation) {
                    /**
                     * Creates new Job
                     */
                    $job = new Job($methodAnnotation, $reflectionMethod, $this->callableName, $this->servers, array(
                        'jobPrefix'            => $this->jobPrefix,
                        'iterations'           => $this->iterations,
                        'method'               => $this->defaultMethod,
                        'minimumExecutionTime' => $this->minimumExecutionTime,
                        'timeout'              => $this->timeout,
                    ));

                    $jobCollection->add($job);
                }
            }
        }

        return $jobCollection;
    }
948142
public ListenableFuture<Map<JobId, Job>> jobs(@Nullable final String jobQuery) {
    return jobs(jobQuery, null);
  }
975180
@Override
    @Transactional
    public Restoration restartRestore(String restoreId) throws SnapshotException {
        Restoration restoration = this.jobManager.stopRestore(restoreId);
        restoration.setEndDate(null);
        restoration.setStatus(RestoreStatus.RETRIEVING_FROM_STORAGE);
        restoration = restoreRepo.save(restoration);
        eventLog.logRestoreUpdate(restoration);
        return this.restoreCompleted(restoration);
    }
807909
public void resetStore() throws BlockStoreException {
        maybeConnect();
        try {
            deleteStore();
            createTables();
            initFromDatabase();
        } catch (SQLException ex) {
            throw new RuntimeException(ex);
        }
    }
147094
public function runDelayed($jobId, callable $runCallback)
    {
        $job = $this->jobProcessor->findJobById($jobId);
        if (!$job) {
            throw new \LogicException(sprintf('Job was not found. id: "%s"', $jobId));
        }

        if ($job->getRootJob()->isInterrupted()) {
            if (!$job->getStoppedAt()) {
                $this->jobProcessor->cancelChildJob($job);
            }

            return;
        }

        if (!$job->getStartedAt()) {
            $this->jobProcessor->startChildJob($job);
        }

        $jobRunner = new self($this->jobProcessor, $job->getRootJob());
        $result = call_user_func($runCallback, $jobRunner, $job);

        if (!$job->getStoppedAt()) {
            $result
                ? $this->jobProcessor->successChildJob($job)
                : $this->jobProcessor->failChildJob($job);
        }

        return $result;
    }
66732
protected function failed()
    {
        $retryCount = $this->model->getTriedCount() + 1;

        if ($retryCount >= $this->getMaxRetryCount()) {
            $this->model->setStatus(JobsConst::JOB_STATUS_FAILED);
        } else {
            $this->model->setStatus(JobsConst::JOB_STATUS_WAITING_RETRY);
            $this->model->setTryAt($this->getNextTryTime());
        }
        $this->model->setTriedCount($retryCount);

        return $this->model->persist();
    }
337553
public function getNewJob() {
        # we can grab a locked job if we own the lock
        $rs = $this->runQuery("
            SELECT id
            FROM   " . self::$jobsTable . "
            WHERE  queue = ?
            AND    (run_at IS NULL OR NOW() >= run_at)
            AND    (locked_at IS NULL OR locked_by = ?)
            AND    failed_at IS NULL
            AND    attempts < ?
            ORDER BY created_at DESC
            LIMIT  10
        ", array($this->queue, $this->name, $this->max_attempts));

        // randomly order the 10 to prevent lock contention among workers
        shuffle($rs);

        foreach ($rs as $r) {
            $job = new DJJob($this->name, $r["id"], array(
                "max_attempts" => $this->max_attempts,
                "fail_on_output" => $this->fail_on_output
            ));
            if ($job->acquireLock()) return $job;
        }

        return false;
    }