The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

perfSONAR_PS::Services::MP::Config::Schedule - Configuration module for the support of scheduled tests for MPs

DESCRIPTION

The purpose of this module separate implementation of parsing configuration files for MPs so that they provide a consistent interface to allow the perfSONAR_PS::Services::MP::Scheduler class to determine the appropriate periodicity and offset times for running measurements by an MP.

SYNOPSIS

  # create the configuration object
  my $schedule = perfSONAR_PS::Services::MP::Config::Schedule->new();

  # set the configuration file to use (note that the definitions of how to
  # parse for the appropriate test periods, and offset times etc for the 
  # individual tests should be defined in an inherited class.
  $schedule->configFile( 'some-config-file-path' ); 
  if ( $schedule->load() == 0 ) {

        # get a list of the test id's to run
        my @testids = $schedule->getAllTestIds();
        
        # determine the period of time from now until the next test should run
        # this will automatically determine the periodicity and conduct
        # a random on the offset to calculate the appropriate time.
        my $time = $schedule->getTestTimeFromNow( $testids[0] );

    print "The next test for '$testid' will run in $time seconds from now.";

  } else {

        print "Something went wrong with parsing file '" . $schedule->configFile() . "'\n";
    return -1;

  }

API

This module exposes the following methods.

new

instantiate a new config object

configFile

accessor/mutator method for the configuration file

config

accessor/mutator method for the configuration

load( $file )

Load and parse the config file $file. Should be overridden by inheriting class.

Returns 0 = everythign okay -1 = something failed

store( $file )

Load and parse the config file $file. Should be overridden by inheriting class.

Returns 0 = everythign okay -1 = something failed

getAllTestIds()

Returns a list of all the testids that have been parsed.

getTestById( $testid )

Returns the test info hash of the test with id $testid (key of hash). The returned hash should be in a key/value format suitable for the configuration tool to use.

getTestPeriodById( $testid )

Returns the test period defined for test id '$testid'.

getTestOffsetById( $testid )

Returns the test offset defined for test id '$testid'.

getTestOffsetTypeById( $testid )

Returns the test offset type defined for test id '$testid'.

getTextNextTimeFromNow( $testid )

Determines the amonut of time from now until the next test for $testid should start.

Returns n = seconds til next test undef = testid does not exist

SEE ALSO

perfSONAR_PS::Services::MP::Scheduler, perfSONAR_PS::Services::Config::PingER, perfSONAR_PS::Services::MP::Agent::Base,

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

  https://mail.internet2.edu/wws/info/i2-perfsonar

The perfSONAR-PS subversion repository is located at:

  https://svn.internet2.edu/svn/perfSONAR-PS 
  

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

VERSION

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

AUTHOR

Yee-Ting Li, ytl@slac.stanford.edu

LICENSE

You should have received a copy of the Internet2 Intellectual Property Framework along with this software. If not, see <http://www.internet2.edu/membership/ip.html>

COPYRIGHT

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

All rights reserved.