NAME

Qudo::Job - Qudo job class

SYNOPSIS

# You don't need to create job object by yourself.

DESCRIPTION

Qudo::Job object is passed to your worker and some hook points.

METHODS

id

Returns job id.

uniqkey

Returns the job unique key.

func_id

Returns the function id of the job.

funcname

Returns the function name of the job.

retry_cnt

Returns how many times the job is retried.

grabbed_until

Returns time when job is grabbed.

priority

Returns the priority of the job.

arg

Returns the job argument.

arg_origin

Returns the original argument before a serializer change.

db

Returns the database the job belonging.

manager

Returns Qudo manager.

job_start_time

Returns time when job started.

completed

Set job as completed successfully.

is_completed

If job is completed, returns true.

is_aborted

If job is aborted, returns true.

is_failed

If job is failed, returns true.

error

Returns error message set in failed or abort

failed

$job->failed($reason);

Don't use this method in your worker class. Use die instead of this. $reason is set as error and logged in exception_log.

abort

$job->abort($reason);

This aborts job. When this method is called, the job never retried even if you set retry_cnt is set. But, if you override work_safely in Qudo::Worker, it is depends on your implementation. $reason is set as error and logged in exception_log.

replace

$job->replace(['Worker::One', {arg => 'arg1'}], ['Worker::Another', {arg => 'arg2'}]);

This enqueue new job(s) and current job itself is completed.