Write the status output for the queue worker.

@param  \Illuminate\Contracts\Queue\Job  $job
@param  bool  $failed
@return void
482248
protected function writeOutput(Job $job, $failed)
	{
		if ($failed)
		{
			$this->output->writeln('<error>Failed:</error> '.$job->getName());
		}
		else
		{
			$this->output->writeln('<info>Processed:</info> '.$job->getName());
		}
	}
1249990
public function failed($e)
    {
        $this->markAsFailed();

        $payload = $this->payload();

        list($class, $method) = $this->parseJob($payload['job']);

        if (method_exists($this->instance = $this->resolve($class), 'failed')) {
            $this->instance->failed($payload['data'], $e);
        }
    }
769686
public function work(Job $job)
    {
        if (!$this->isFree()) {
            throw new Exceptions\EmployeeNotFreeException();
        }

        $this->workPid = pcntl_fork();

        if ($this->workPid == -1) {
            throw new Exceptions\ForkFailedException();
        }

        $this->workState = self::BUSY;
        $this->job = $job;

        if ($this->workPid == 0) {
            try {
                $job->perform();
                exit(0);
            } catch (\Throwable $exception) {
                Logger::getLogger()->error('Uncaught exception in Emphloyer Job.', [
                    'job_class' => get_class($job),
                    'job_id' => $job->getId(),
                    'exception_code' => $exception->getCode(),
                    'exception_message' => $exception->getMessage(),
                    'exception_stacktrace' => $exception->getTraceAsString(),
                    'exception' => $exception
                ]);
                exit(1);
            }
        }
    }
938070
protected void failure(final Throwable thrwbl, final Job job, final String curQueue) {
        // The job may have taken a long time; make an effort to ensure the connection is OK
        JedisUtils.ensureJedisConnection(this.jedis);
        try {
            this.jedis.incr(key(STAT, FAILED));
            this.jedis.incr(key(STAT, FAILED, this.name));
            final FailQueueStrategy strategy = this.failQueueStrategyRef.get();
            final String failQueueKey = strategy.getFailQueueKey(thrwbl, job, curQueue);
            if (failQueueKey != null) {
                final int failQueueMaxItems = strategy.getFailQueueMaxItems(curQueue);
                if (failQueueMaxItems > 0) {
                    Long currentItems = this.jedis.llen(failQueueKey);
                    if (currentItems >= failQueueMaxItems) {
                        Transaction tx = this.jedis.multi();
                        tx.ltrim(failQueueKey, 1, -1);
                        tx.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                        tx.exec();
                    } else {
                        this.jedis.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                    }
                } else {
                    this.jedis.rpush(failQueueKey, failMsg(thrwbl, curQueue, job));
                }
            }
        } catch (JedisException je) {
            LOG.warn("Error updating failure stats for throwable=" + thrwbl + " job=" + job, je);
        } catch (IOException ioe) {
            LOG.warn("Error serializing failure payload for throwable=" + thrwbl + " job=" + job, ioe);
        }
        this.listenerDelegate.fireEvent(JOB_FAILURE, this, curQueue, job, null, null, thrwbl);
    }
861171
public function enqueue(Job\WrappedJob $job) {
        $serialized = Job\serializeJobs([$job->withQueueProvider('sync')]);
        $res = unserialize($this->worker->work($serialized));
        if ($res[0]->isFailed()) {
            throw new \RuntimeException("Job Failed - " . json_encode($res[0], JSON_PRETTY_PRINT));
        }
    }
810884
public function completed(JobPayload $payload, $failed = false)
    {
        if ($payload->isRetry()) {
            $this->updateRetryInformationOnParent($payload, $failed);
        }

        $this->connection()->pipeline(function ($pipe) use ($payload, $failed) {
            $this->markJobAsCompleted($pipe, $payload->id(), $failed);
        });
    }
255362
protected function raiseFailedJobEvent($connection, Job $job)
	{
		if ($this->events)
		{
			$data = json_decode($job->getRawBody(), true);

			$this->events->fire('illuminate.queue.failed', array($connection, $job, $data));
		}
	}
1078971
public synchronized void failJob(JobInProgress job) {
    if (null == job) {
      LOG.info("Fail on null job is not valid");
      return;
    }

    JobStatus prevStatus = (JobStatus)job.getStatus().clone();
    LOG.info("Failing job " + job.getJobID());
    job.fail();

    // Inform the listeners if the job state has changed
    JobStatus newStatus = (JobStatus)job.getStatus().clone();
    if (prevStatus.getRunState() != newStatus.getRunState()) {
      JobStatusChangeEvent event =
        new JobStatusChangeEvent(job, EventType.RUN_STATE_CHANGED, prevStatus,
            newStatus);
      updateJobInProgressListeners(event);
    }
  }
526796
def print_failed(self, stream=sys.stderr):
        
        for job_key, job_details in sorted(self.scatter_link.jobs.items()):
            if job_details.status == JobStatus.failed:
                stream.write("Failed job %s\n  log = %s\n" %
                             (job_key, job_details.logfile))
76853
private function pushExecutedJob(Job $job)
    {
        $this->executed_jobs[] = $job;
        $command = $job->getCommand();
        $args = $job->getArguments();
        // If callable, log the string Closure
        if (is_callable($command)) {
            $command = \is_string($command) ? $command : 'Closure';
        }
        $this->addSchedulerVerboseOutput("<green>Success</green>: <white>{$command} {$args}</white>");

        return $job;
    }
292451
private function setWorkingOn(Job $job)
    {
        $this->setTask(
            [
                'queue' => $job->getQueue(),
                'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'),
                'payload' => $job->getPayload(),
            ]
        );

        $this->current_job = $job;
        $job->setWorker($this->getId());
        $this->job_manager->updateStatus($job, JobManager::STATUS_RUNNING);
    }
264511
protected function raiseFailedJobEvent($connection, Job $job)
	{
		if ($this->events)
		{
			$this->events->fire('flyphp.queue.failed', array($connection, $job));
		}
	}
1301191
public function workingOn(Job &$job)
    {
        $this->job = $job;
        $job->setWorker($this);

        Event::fire(Event::WORKER_WORKING_ON, array($this, $job));

        $this->redis->hmset(self::redisKey($this), array(
            'job_id'      => $job->getId(),
            'job_started' => microtime(true)
        ));
    }
632449
public static function onFailure(\Exception $e, \Resque_Job $job)
    {
        /** @var JobBase $failedJob */
        $failedJob = $job->getInstance();
        $failedJob->errorLog('Caught exception in '. get_called_class() . ': ' . $e->getMessage());
        $failedJob->getStat()->increment($failedJob->getStatFailureIncrementKey());
        throw $e;
    }
38492
protected function markJobAsFailedIfWillExceedMaxAttempts(Job $job, $maxTries, $e)
    {
        if ($maxTries > 0 && $job->attempts() >= $maxTries) {
            $this->failJob($job, $e);
        }
    }
1245086
public function workingOn(Job $job)
    {
        $job->worker = $this;
        $this->currentJob = $job;
        $job->updateStatus(Status::STATUS_RUNNING);
        $data = json_encode(array(
            'queue' => $job->queue,
            'run_at' => strftime('%a %b %d %H:%M:%S %Z %Y'),
            'payload' => $job->payload
        ));
        Resque::redis()->set('worker:' . $job->worker, $data);
    }
718927
private function runAsParent(Job $job): void
    {
        $status = sprintf('Forked %s for ID: %s', $this->child, $job->getId());
        $this->updateProcLine($status);

        $this->log->debug(
            $status,
            [
                'type' => 'fork',
                'worker' => $this->worker_name,
                'job_id' => $job->getId(),
            ]
        );

        pcntl_wait($wait_status);
        $exit_status = pcntl_wexitstatus($wait_status);

        if ($exit_status !== 0) {
            $this->job_manager->failJob(
                $job,
                new DirtyExitException(
                    sprintf('Job Exited with exit code %d', $exit_status)
                )
            );
        }
    }