Job::Machine::DB
version 0.26
Job::Machine::DB - Database class for Job::Machine
my $client = Job::Machine::DB->new( dbh => $dbh, queue => 'queue.subqueue', ); my $client = Job::Machine::Base->new( dsn => @dsn, );
Returns the serializer, default Data::Serializer
Sets up the listener. Quit listening to the named queues. If 'reply' is passed, we listen to the related reply queue instead of the task queue.
Return undef immediately if no queue is provided.
$self->listen( queue => 'queue_name' ); $self->listen( queue => \@queues, reply => 1 );
Quit listening to the named queues. If 'reply' is passed, we unlisten to the related reply queue instead of the task queue.
$self->unlisten( queue => 'queue_name' ); $self->unlisten( queue => \@queues, reply => 1 );
Sends an asynchronous notification to the named queue, with an optional payload. If 'reply' is true, then the queue names are taken to be reply.
Return undef immediately if no queue name is provided.
$self->notify( queue => 'queue_name' ); $self->notify( queue => 'queue_name', reply => 1, payload => $data );
Retrieve one notification, if there is one
Retrievies the pending notifications.
my $notifies = $self->get_notification();
The return value is an arrayref where each row looks like this:
my ($name, $pid, $payload) = @$notify;
Wait for a notification. The required parameter timeout tells for how long time to wait.
Fetch one work task from the task table
Insert a row in the task table
Update the task with a new status
Fetch a class
Fetch a task
Insert a row in the class table
Insert a row in the result table
Argument
data - either a scalar value that will be inserted as the result, or a hashref containing the type and result
Fetch a result using the result id
Fetch a result using the task id
Fetch all results of a given task
Fetch all distinct statuses
Fetch all classes
Fetch all tasks, joined with the class for a suitable name
1. Find started tasks that have passed the time limit, most probably because of a dead worker. (status 100, modified < now - max_runtime) 2. Trim status so task can be tried again
1. Find tasks that have failed too many times (# of result rows > $self->retries 2. fail them (Set status 900) There's a hard limit (100) for how many tasks can be failed at one time for performance resons
3. Find tasks that should be removed (remove_task < now) - delete them - log
Select the first row from the given sql statement
Select all rows from the given sql statement
Very light weight where clause builder
Very light weight order-by builder
Kaare Rasmussen <kaare@cpan.org>.
Copyright (C) 2009,2015, Kaare Rasmussen
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
Kaare Rasmussen <kaare at cpan dot net>
This software is copyright (c) 2015 by Kaare Rasmussen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Job::Machine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Job::Machine
CPAN shell
perl -MCPAN -e shell install Job::Machine
For more information on module installation, please visit the detailed CPAN module installation guide.