NAME
IPC::DirQueue::Job - an IPC::DirQueue task
SYNOPSIS
my $dq = IPC::DirQueue->new({ dir => "/path/to/queue" });
my $job = $dq->pickup_queued_job();
my $path = $job->get_data_path();
# ...
$job->finish();
DESCRIPTION
A job object returned by IPC::DirQueue
. This class provides various methods to access job information, and report job progress and completion.
DATA
Any submitted metadata can be accessed through the $job->{metadata}
hash reference. For example:
print "email: ", $job->{metadata}->{submitter_email}, "\n";
METHODS
- $path = $job->get_data_path();
-
Return the full path to the task's data file. This can be opened and read safely while the job is active.
- $nbytes = $job->get_data_size_bytes();
-
Retrieve the size of the data without performing a
stat
operation. - $secs = $job->get_time_submitted_secs();
-
Get the seconds-since-epoch (in other words, the
time_t
) on the submitting host when this task was submitted. - $usecs = $job->get_time_submitted_usecs();
-
Get the microseconds within that second, as measured by
gettimeofday
on the submitting host, when this task was submitted. - $hostname = $job->get_hostname_submitted();
-
Get the name of the submitting host where this task originated.
- $job->touch_active_lock();
-
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. - $job->finish();
-
Report that the job has been completed, and may be removed from the queue.
- $job->return_to_queue();
-
Return the job to the queue, unfinished. Another task processor may then pick it up.