NAME

Minion::Job - Minion job

SYNOPSIS

use Minion::Job;

my $job = Minion::Job->new(id => $oid, minion => $minion, task => 'foo');

DESCRIPTION

Minion::Job is a container for Minion jobs.

ATTRIBUTES

Minion::Job implements the following attributes.

args

my $args = $job->args;
$job     = $job->args([]);

Arguments passed to task.

id

my $oid = $job->id;
$job    = $job->id($oid);

Job id.

minion

my $minion = $job->minion;
$job       = $job->minion(Minion->new);

Minion object this job belongs to.

task

my $task = $job->task;
$job     = $job->task('foo');

Task name.

METHODS

Minion::Job inherits all methods from Mojo::Base and implements the following new ones.

app

my $app = $job->app;

Get application from "app" in Minion.

# Longer version
my $app = $job->minion->app;

created

my $epoch = $job->created;

Time this job was created in floating seconds since the epoch.

error

my $err = $job->error;

Get error for failed job.

fail

$job = $job->fail;
$job = $job->fail('Something went wrong!');

Transition from active to failed state.

finish

$job = $job->finish;

Transition from active to finished state.

finished

my $epoch = $job->finished;

Time this job transitioned from active to failed or finished in floating seconds since the epoch.

perform

$job->perform;

Perform job in new process and wait for it to finish.

remove

my $bool = $job->remove;

Remove failed, finished or inactive job from queue.

restart

$job = $job->restart;

Transition from failed or finished state back to inactive.

restarts

my $num = $job->restarts;

Get number of times this job has been restarted.

started

my $epoch = $job->started;

Time this job transitioned from inactive to active in floating seconds since the epoch.

state

my $state = $job->state;

Get current state of job, usually active, failed, finished or inactive.

SEE ALSO

Minion, Mojolicious::Guides, http://mojolicio.us.