1Parallel::Scoreboard(3)User Contributed Perl DocumentatioPnarallel::Scoreboard(3)
2
3
4

NAME

6       Parallel::Scoreboard - a scoreboard for monitoring status of many
7       workers
8

SYNOPSIS

10         use Parallel::Scoreboard;
11
12         my $scoreboard = Parallel::Scoreboard->new(
13             base_dir => '/tmp/my_scoreboard'
14         ...
15
16         # in each worker process
17         $scoreboard->update('this is my current status');
18
19         # to read status of all worker processes
20         my $stats = $scoreboard->read_all();
21         for my $pid (sort { $a <=> $b } keys %$stats) {
22             print "status for pid:$pid is: ", $stats->{$pid}, "\n";
23         }
24

DESCRIPTION

26       Parallel::Scoreboard is a pure-perl implementation of a process
27       scoreboard.  By using the module it is easy to create a monitor for
28       many worker process, like the status module of the Apache HTTP server.
29
30       Unlike other similar modules, Parallel::Scoreboard is easy to use and
31       has no limitation on the format or the length of the statuses to be
32       stored.  Any arbitrary data (like JSON or frozen perl object) can be
33       saved by the worker processes as their status and read from the manager
34       process.
35

METHODS

37   new(%args)
38       instantiation.  Recognizes the following paramaters.  The parameters
39       can be read using the read-only accessors with the same name.
40
41       base_dir => $base_dir
42
43       the directory name in which the scoreboard files will be stored.  The
44       directory will be created if it does not exist already.  Mandatory
45       parameter.
46
47       worker_id => sub { ... }
48
49       a subref that returns the id of the worker (if omitted, the module uses
50       $$ (process id) to distinguish between the workers)
51
52   update($status)
53       saves the status of the process
54
55   read_all()
56       reads the status of all worker processes that are alive and that have
57       called update() more than once.  Returned value is a hashref with
58       process ids as keys and the statuses of each processes as corresponding
59       values.
60
61   cleanup()
62       remove obsolete status files found in base_dir.  The files are normally
63       removed upon the termination of worker process, however they might be
64       left unremoved if the worker process was killed for some reason.  The
65       detection and removal of the obsolete status files is performed by
66       read_all() as well.
67

SEE ALSO

69       IPC::ScoreBoard Proc::Scoreboard
70

AUTHOR

72       Kazuho Oku <kazuhooku gmail.com>
73

LICENSE

75       This program is free software, you can redistribute it and/or modify it
76       under the same terms as Perl 5.10.
77
78
79
80perl v5.30.0                      2019-07-26           Parallel::Scoreboard(3)
Impressum