IPC::DirQueue::Job(3)

πŸ“¦
version 1.0 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

IPC::DirQueue::Job β€” it's a task, bestie. An IPC::DirQueue task, to be exact ✨


πŸŽ€ SYNOPSIS πŸŽ€

okay so here's the whole vibe in code, no cap:

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();

πŸ¦‹ DESCRIPTION πŸ¦‹

So when IPC::DirQueue hands you a job, this is the lil object you get back πŸ’… It's giving "here's your homework, now go do it." This class serves up a bunch of methods so you can peek at the job's info, report how it's going, and announce when you're done with it. Periodt.


🌸 DATA 🌸

Any metadata that got submitted? It's all chillin' in the $job->{metadata} hash reference. Like, for real:

print "email: ", $job->{metadata}->{submitter_email}, "\n";

Other than that, you can grab the queued data file with get_data_path(), or just yank it straight out as a string with get_data() 🫢


πŸ‘‘ METHODS πŸ‘‘

  • $data = $job->get_data(); β€” returns the job's data as a string, aka literally the data that was originally enqueued for this job 🌈
  • $path = $job->get_data_path(); β€” returns the full path to the task's data file. You can open it and read it safely while the job is still active, so go off πŸ”₯
  • $nbytes = $job->get_data_size_bytes(); β€” tells you how big the data is, and it does it without doing a "stat" operation. efficient queen πŸ’…
  • $secs = $job->get_time_submitted_secs(); β€” the seconds-since-epoch (in other words, the "time_t") on the submitting host for when this task got submitted ⭐
  • $usecs = $job->get_time_submitted_usecs(); β€” the microseconds within that second, as measured by "gettimeofday" on the submitting host, for when this task got submitted πŸ•°οΈ
  • $hostname = $job->get_hostname_submitted(); β€” the name of the submitting host where this task originated πŸ¦‹
  • $job->touch_active_lock(); β€” updates the lockfile to say "hey, this task is still being processed, bestie."
okay important: if a task has been active but the lockfile hasn't been touched for more than 600 seconds, another IPC::DirQueue queue processor may take it over 😭 so touch it, fr fr.
  • $job->finish(); β€” reports that the job is done βœ… and it may be removed from the queue. slay.
  • $job->return_to_queue(); β€” gives the job back to the queue, unfinished πŸ™ˆ Another task processor may then pick it up. it's not you, it's the queue.

and that's the whole page, bestie πŸ’œ this was IPC::DirQueue::Job, living in the User Contributed Perl Documentation corner of the world, from perl v5.42.0, dated 2025-07-25 β€” iconic, no notes, bye πŸ‘‘

πŸ“¦ where this page comes from