Giter VIP home page Giter VIP logo

p5-parallel-scoreboard's Introduction

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

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.

p5-parallel-scoreboard's People

Contributors

autarch avatar hirose31 avatar kazuho avatar sergeyromanov avatar tolid avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.