View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Aaron Brown > perfSONAR_PS-Services-PingER-0.09 > perfSONAR_PS::Services::MP::Scheduler



Annotate this POD

View/Report Bugs
Module Version: 0.09   Source  


perfSONAR_PS::Services::MP::Scheduler - A module that will implements a very simple scheduler from which MP's can inherit to run tests etc.


This module allows a more intelligent method of running tests in a non-periodic fashion. It does this with the configuration of a perfSONAR_PS::Services::MP::Config module that provides a list and configuration of the tests to be run.

This module keeps two data structures of interest: METADATA which contains all the tests indexed by the metadataId, and SCHEDULE which maintains a hash of epoch time of the test with the metadataId (we do not point to the METADATA datastructure directly as we need the id's sometimes.)


  # create a new MP that inherits this scheduler
  my $mp = perfSONAR_PS::Schedule::MP::PingER->new( $config );
  # set up the schedule with the list of tests and fork off a manager class
  # that will spawn off tests according to a schedule that should be also
  # defined here.


This module exposes the following methods.


Create a new MP Scheduler class $conf is ref to hash of configuration settings


accessor/mutator for the schedule


accessor/mutator for the config storing the mp::config::schedule package

init( $handler )

Initiate the mp. This should involve: - setting the configuration defaults to be used - setting up the schedule for the tests (by using a perfSONAR_PS::Services::MP::Config::Schedule - or inherited object) - attaching message handlers for the daemon architecture from $handler - forking off a scheduler to manage the starting of new measurements.


prepare the metadata; in this case, we add the relevant tests into the schedule in preparation for run()


Populates the schedule for tests to be run

needLS( boolean )

is the mp service setup to register with a LS?


actually register the MP service with a LS, ie send some xml of the metadata available form the MP service (ie what tests it can run)

addTestSchedule( $config )

Adds the schedule list of tests from the perfSONAR_PS::MP::Config::Schedule object


Returns the current time in epoch seconds


removes the next test from the schedule

Returns ( $time, $testid ) for the time in epoch seconds $time when test with id $testid should be started. If there is no test defined, returns (undef,undef)


Gives the next testid without removing it from the schedule

Returns ( $time, $testid ); where $start is the epoch seconds when the test $testid should start. If there is no next test, then will return (undef, undef);

addNextTest( $time, $testid )

Places the test with id $testid into the schedule to run at time $time.

maxChildren( $number )

accessor/mutator for the number of max child threads/processes


Forks off a new instance that will act as a manager/boss class for the scheduling and forking off of new measurements.

__run( )

Starts an endless loop scheduling and running tests as defined in $self->{'STORE'} until the program is terminated.


block signal interruption


allow interrupts to do as they did

waitForNextTest( )

Blocking function that sleeps until the next test. Problem is that ipc can cause the sleep to exit for any signal. Therefore, some cleverness in determine the actual slept time is required.

doTest( $pid, $testid )

Spawns off a forked instance in order to run the test with id $testid. It will create a perfSONAR_PS::MP::Agent class that will actuall deal with the running of the test and collation of the results.

The forked instance will also deal with the storage defintions by calling the $self->storeData() method which should be overridden by inheriting classes to store the output of the $agent into an MA.

Forked instance will exit at the end of the test. Success and or failure is not propogated back up the stack.

getAgent( $test )

Returns the relevant perfSONAR_PS::MP::Agent class to use for the test. As this class should be inherieted, this method should be overridden to return the appropraote agent to use for the hash $test that contains the parameters for the test.

storeData( $agent, $testid )

Does the relevant storage of data collected from the $agent for the test id $testid.


perfSONAR_PS::Services::Config::Schedule, perfSONAR_PS::Services::MP::Agent::Base, perfSONAR_PS::Services::Base,

To join the 'perfSONAR-PS' mailing list, please visit:

The perfSONAR-PS subversion repository is located at: 

Questions and comments can be directed to the author, or the mailing list.


$Id: 524 2007-09-05 17:35:50Z aaron $


Yee-Ting Li,


You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <>


Copyright (c) 2004-2007, Internet2 and the University of Delaware

All rights reserved.

syntax highlighting: