IPC::DirQueue::Job - an IPC::DirQueue task
my $dq = IPC::DirQueue->new({ dir => "/path/to/queue" }); my $job = $dq->pickup_queued_job(); open(IN, "<".$job->get_data_path()); my $str = <IN>; # ... close IN; $job->finish(); # or... my $data = $job->get_data(); $job->finish();
A job object returned by IPC::DirQueue. This class provides various methods to access job information, and report job progress and completion.
IPC::DirQueue
Any submitted metadata can be accessed through the $job->{metadata} hash reference. For example:
$job->{metadata}
print "email: ", $job->{metadata}->{submitter_email}, "\n";
Otherwise, you can access the queued data file using get_data_path(), or directly as a string using get_data().
get_data_path()
get_data()
Return the job's data. The return value will be a string, the data that was originally enqueued for this job.
Return the full path to the task's data file. This can be opened and read safely while the job is active.
Retrieve the size of the data without performing a stat operation.
stat
Get the seconds-since-epoch (in other words, the time_t) on the submitting host when this task was submitted.
time_t
Get the microseconds within that second, as measured by gettimeofday on the submitting host, when this task was submitted.
gettimeofday
Get the name of the submitting host where this task originated.
Update the lockfile to reflect that this task is still being processed. If a task has been active, but the lockfile has not been touched for more than 600 seconds, another IPC::DirQueue queue processor may take it over.
Report that the job has been completed, and may be removed from the queue.
Return the job to the queue, unfinished. Another task processor may then pick it up.
To install IPC::DirQueue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IPC::DirQueue
CPAN shell
perl -MCPAN -e shell install IPC::DirQueue
For more information on module installation, please visit the detailed CPAN module installation guide.