Paralle...reboard(3)

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

πŸ’– Parallel::Scoreboard β€” bestie, it's a scoreboard for your workers πŸ’–

okay so this is Parallel::Scoreboard(3), from the User Contributed Perl Documentation corner of the manual. it's a whole module for watching a bunch of worker processes do their thing, and honestly? it's giving Apache status module but make it perl. let's go 🫢


✨ NAME ✨

Parallel::Scoreboard β€” a scoreboard for monitoring status of many workers 🌸


πŸŽ€ SYNOPSIS πŸŽ€

use Parallel::Scoreboard;

my $scoreboard = Parallel::Scoreboard->new(
    base_dir => '/tmp/my_scoreboard'
...

# in each worker process
$scoreboard->update('this is my current status');

# to read status of all worker processes
my $stats = $scoreboard->read_all();
for my $pid (sort { $a <=> $b } keys %$stats) {
    print "status for pid:$pid is: ", $stats->{$pid}, "\n";
}

like. look at that. so clean. no notes. πŸ’…


🌈 DESCRIPTION 🌈

Parallel::Scoreboard is a pure-perl implementation of a process scoreboard. by using the module it is easy to create a monitor for many worker process, like the status module of the Apache HTTP server. yes bestie, that Apache status module. iconic behaviour fr fr.

and here's the part that makes it different from other similar modules: Parallel::Scoreboard is easy to use, and it has no limitation on the format or the length of the statuses to be stored. any arbitrary data β€” like JSON, or a frozen perl object, literally whatever your heart desires β€” can be saved by the worker processes as their status and read from the manager process. the range?? unmatched. ✨


πŸ‘‘ METHODS πŸ‘‘

πŸ¦‹ new(%args)

instantiation, babes. it recognizes the following paramaters (yes that's the original spelling, we respect it). The parameters can be read using the read-only accessors with the same name.

  • base_dir => $base_dir β€” the directory name in which the scoreboard files will be stored. The directory will be created if it does not exist already. this one is a Mandatory parameter, so don't forget it or it's giving error πŸ’€
  • worker_id => sub { ... } β€” a subref that returns the id of the worker. if you omit it, the module just uses $$ (the process id) to distinguish between the workers. lowkey convenient ngl.

πŸ“ update($status)

saves the status of the process. that's it. that's the method. your worker calls it, the scoreboard knows what's up. 🫢

πŸ’œ read_all()

reads the status of all worker processes that are alive and that have called update() more than once. Returned value is a hashref with process ids as keys and the statuses of each processes as corresponding values.

so you get a whole lil map of every living worker and what it's currently serving. main character energy honestly. πŸ‘‘

⭐ cleanup()

remove obsolete status files found in base_dir. The files are normally removed upon the termination of worker process, however they might be left unremoved if the worker process was killed for some reason. 😭 (rip)

and plot twist bestie β€” the detection and removal of the obsolete status files is performed by read_all() as well. so it's kinda self-cleaning. we love an efficient queen. 🧚


🌸 SEE ALSO 🌸

IPC::ScoreBoard Proc::Scoreboard


πŸ’… AUTHOR πŸ’…

Kazuho Oku <kazuhooku gmail.com>


πŸ“œ LICENSE πŸ“œ

This program is free software, you can redistribute it and/or modify it under the same terms as Perl 5.10.


ok that's the whole page, no cap. go forth and monitor ur workers bestie πŸ¦‹

and that's a wrap!! this was perl v5.42.0, dated 2025-07-25, filed under Paralle...reboard(3) β€” yeah the title got truncated in the footer, she's mysterious like that πŸ’€βœ¨ bye pookie, slay ur processes πŸ’–

πŸ“¦ where this page comes from