GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  PARALLEL::SCOREBOARD (3)

.ds Aq ’

NAME

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

CONTENTS

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";
  }



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.

Unlike other similar modules, Parallel::Scoreboard is easy to use and has no limitation on the format or the length of the statuses to be stored. Any arbitrary data (like JSON or frozen perl object) can be saved by the worker processes as their status and read from the manager process.

METHODS

    new(%args)

instantiation. Recognizes the following paramaters. 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. Mandatory parameter.

worker_id => sub { ... }

a subref that returns the id of the worker (if omitted, the module uses $$ (process id) to distinguish between the workers)

    update($status)

saves the status of the process

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.

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. The detection and removal of the obsolete status files is performed by read_all() as well.

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.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 PARALLEL::SCOREBOARD (3) 2015-01-26

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.