<<

NAME

Inca::ReporterManager::Scheduler::Cron - Executes reporters on a periodic schedule

SYNOPSIS

  use Inca::ReporterManager::Scheduler::Cron;
  use Inca::Config::Suite::SeriesConfig;
  use Inca::ReporterManager::ReporterCache;
  use Cwd;
  use File::Spec;
  my $file_depot = "file://" . File::Spec->catfile(getcwd(), "depot.$$");
  my $cron = { min => "0-59/2" }; # execute every 2 mins
  my $sched = new Inca::ReporterManager::Scheduler::Cron( 
                    1,
                    [ $file_depot ],
                    120,
                    "resourceA",
                    new Inca::ReporterManager::ReporterCache( 't',
                      errorReporterPath => "bin/inca-null-reporter" 
                    ),
                    undef, 
                    $cron );
  $sched->start();
  my $config = new Inca::Config::Suite::SeriesConfig();
  $config->setName( "echo_report" );
  $config->setVersion( "1" );
  $config->setPath( getcwd() . "/t/echo_report" );
  $config->setContext( $config->getName() );
  $sched->submit( 'add', $config );
  # ...
  $sched->stop();

A scheduler for the reporter manager which executes reporters on a periodic schedule. It takes as its parameter a cron specification and uses the Schedule::Cron module from CPAN to handle the scheduling.

CLASS METHODS

new( $args, $check_period, $credentials, $depots, $depot_timeout, $reporter_cache, $rim_path, $tmpdir )

Class constructor which returns a new Inca::ReporterManager::Scheduler::Cron object. The constructor must be called with the following arguments.

Arguments:

args

A reference to a hash array containing the schedulers configuration inforamtion

check_period

A positive integer indicating the period in seconds of which to check the reporter for exceeding resource limits.

credentials

A reference to a hash array containing the credential information.

depots

A reference to an array of depot uris. The report will be sent to the first depot in the list. If the first depot is unreachable, the next depots in the list will be tried.

depot_timeout

A positive integer indicating the period in seconds of which to time out a send of a report to the depot.

reporter_cache

An object of type Inca::ReporterManager::ReporterCache which is used to map reporter uris to a local path.

rim_path

A string containing the path to the reporter-instance-manager program.

tmpdir

A string containing a path to a temporary file space that Inca can use while executing reporters

isRunning( )

Check if the cron scheduler is running.

Returns:

Returns true if the cron scheduler is running and false otherwise.

start( )

Starts cron scheduler up.

Returns:

Returns true if there were no errors starting the scheduler; returns false otherwise.

stop( )

Stops cron scheduler.

Returns:

Returns true if there were no errors starting the scheduler; returns false otherwise.

submit( $action, @configs )

Accepts an action (currently only 'add') and any number of reporters. These reporters will then be executed in a sequential order.

Arguments:

action

A string containing an action (e.g., add, delete) pertaining to the group of reporters.

configs

An array of Inca::Config::Suite::SeriesConfig objects.

Returns:

Returns true if at least one reporter is executed; otherwise returns false.

AUTHOR

Shava Smallen <ssmallen@sdsc.edu>

CAVEATS/WARNINGS

No known problems.

SEE ALSO

Inca::ReporterManager::Scheduler

<<