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;

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.

perform

$job->perform;

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

state

my $state = $job->state;

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

SEE ALSO

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