1IPC::DirQueue::Job(3) User Contributed Perl DocumentationIPC::DirQueue::Job(3)
2
3
4
6 IPC::DirQueue::Job - an IPC::DirQueue task
7
9 my $dq = IPC::DirQueue->new({ dir => "/path/to/queue" });
10 my $job = $dq->pickup_queued_job();
11
12 open(IN, "<".$job->get_data_path());
13 my $str = <IN>;
14 # ...
15 close IN;
16 $job->finish();
17
18 # or...
19
20 my $data = $job->get_data();
21 $job->finish();
22
24 A job object returned by "IPC::DirQueue". This class provides various
25 methods to access job information, and report job progress and
26 completion.
27
29 Any submitted metadata can be accessed through the "$job->{metadata}"
30 hash reference. For example:
31
32 print "email: ", $job->{metadata}->{submitter_email}, "\n";
33
34 Otherwise, you can access the queued data file using "get_data_path()",
35 or directly as a string using "get_data()".
36
38 $data = $job->get_data();
39 Return the job's data. The return value will be a string, the data
40 that was originally enqueued for this job.
41
42 $path = $job->get_data_path();
43 Return the full path to the task's data file. This can be opened
44 and read safely while the job is active.
45
46 $nbytes = $job->get_data_size_bytes();
47 Retrieve the size of the data without performing a "stat"
48 operation.
49
50 $secs = $job->get_time_submitted_secs();
51 Get the seconds-since-epoch (in other words, the "time_t") on the
52 submitting host when this task was submitted.
53
54 $usecs = $job->get_time_submitted_usecs();
55 Get the microseconds within that second, as measured by
56 "gettimeofday" on the submitting host, when this task was
57 submitted.
58
59 $hostname = $job->get_hostname_submitted();
60 Get the name of the submitting host where this task originated.
61
62 $job->touch_active_lock();
63 Update the lockfile to reflect that this task is still being
64 processed. If a task has been active, but the lockfile has not been
65 touched for more than 600 seconds, another "IPC::DirQueue" queue
66 processor may take it over.
67
68 $job->finish();
69 Report that the job has been completed, and may be removed from the
70 queue.
71
72 $job->return_to_queue();
73 Return the job to the queue, unfinished. Another task processor
74 may then pick it up.
75
76
77
78perl v5.34.0 2022-01-21 IPC::DirQueue::Job(3)