createFailure

@param array $payload
@param \Throwable $exception
@param string $worker
@param string $queue
193158
public function createFailure(array $payload, Throwable $exception, string $worker, string $queue): void
    {
        $data = [];
        $data['failed_at'] = strftime('%a %b %d %H:%M:%S %Z %Y');
        $data['payload'] = $payload;
        $data['exception'] = get_class($exception);
        $data['error'] = $exception->getMessage();
        $data['backtrace'] = explode("\n", $exception->getTraceAsString());
        $data['worker'] = $worker;
        $data['queue'] = $queue;

        $this->client->setex(
            sprintf('failed:%s', $payload['id']),
            3600 * 14,
            json_encode($data)
        );
    }
827504
public function pushBulk($jobs = [], $queue = self::QUEUE)
    {
        $ids = [];
        foreach ($jobs as $job) {
            if (!isset($job['class'])) {
                throw new Exception('pushBulk: each job needs a job class');
            }
            if (!isset($job['args']) || !is_array($job['args'])) {
                throw new Exception('pushBulk: each job needs args');
            }

            $retry = isset($job['retry']) ? $job['retry'] : true;
            $doAt = isset($job['at']) ? $job['at'] : null;

            $jobId = $this->idGenerator->generate();
            array_push($ids, $jobId);
            $this->atomicPush($jobId, $job['class'], $job['args'], $queue, $retry, $doAt);
        }

        return $ids;
    }
48093
public function recreate($payload, $queue = null, $delay)
    {
        $options = array('delay' => $this->getSeconds($delay));

        return $this->pushRaw($payload, $queue, $options);
    }
1241290
public function failure( $job, Exception $exception ) {
		$insert = $this->database->insert( $this->failures_table, array(
			'job'       => serialize( $job ),
			'error'     => $this->format_exception( $exception ),
			'failed_at' => $this->datetime(),
		) );

		if ( $insert ) {
			$this->delete( $job );

			return true;
		}

		return false;
	}
1097485
public function pushRaw($payload, $queue = null, array $options = [])
    {
        $this->getConnection()->rPush($this->getQueue($queue), $payload);

        return Arr::get(json_decode($payload, true), 'id');
    }
48087
protected function createPayload($job, $data = '', $queue = null)
	{
		if ($job instanceof Closure)
		{
			return json_encode($this->createClosurePayload($job, $data));
		}
		else
		{
			return json_encode(array('job' => $job, 'data' => $data));
		}
	}
79682
public function log($connection, $queue, $payload)
    {
        $failed_at = date(DateTime::MYSQL_DATETIME);
        $this->getDb()->insertAsDict($this->table, compact('connection', 'queue', 'payload', 'failed_at'));
    }
48212
def create_message(self):
        """"""

        body = dedent("""\
        Received exception {exception} on {queue} from worker {worker}:

        {traceback}

        Payload:
        {payload}

        """).format(exception=self._exception,
                   traceback=self._traceback,
                   queue=self._queue,
                   payload=self._payload,
                   worker=self._worker)

        return MIMEText(body)
1164226
public function logFailure($message, \Exception $exception = null)
    {
        $this->buildLogger->logFailure($message, $exception);
    }
349220
public function onError($error, WorkerInterface $worker)
    {
        $info = $worker->getJobInfo();
        $this->errors[$info->file] = $error;
        $failures = $this->result->getFailureCount();
        $this->result->setFailureCount(++$failures);
    }
1146862
protected function markJobAsFailedIfAlreadyExceedsMaxAttempts($job, $maxTries)
    {
        if ($maxTries === 0 || $job->attempts() <= $maxTries) {
            return;
        }
        $e = new Exception(
            'A queued job has been attempted too many times. The job may have previously timed out.'
        );
        $this->failJob($job, $e);
        throw $e;
    }
674394
public function always($result, $payload, Delivery $delivery, AbstractListener $listener, Exception $exception = null)
    {
        if ($exception) {
            throw $exception;
        }
    }
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);
        }
    }
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);
        });
    }
195498
protected function writeFailure(\PHPUnit_Framework_Test $test, \Exception $e, $time)
    {
        $this->writeFailureOrError($test, $e, $time, 'failure');
    }
825877
public static function create($result,$message,array $arguments=array(),\Exception $exception=null)
    {
        $map = array(
            static::SUCCEED => 'createSucceed',
            static::FAILED => 'createFailed',
            static::BROKEN => 'createBroken',
            static::ERROR => 'createError',
        );

        return call_user_func(
            array(__CLASS__,$map[$result]),
            $message,
            $arguments,
            $exception
        );
    }
615943
def fail(exception)
      begin
        run_failure_hooks(exception)
      rescue Exception => e
        raise e
      ensure
        Failure.create \
          :payload   => payload,
          :exception => exception,
          :worker    => worker,
          :queue     => queue
      end
    end