<<

NAME

Inca::ReporterManager - Executes an Inca reporter suite

SYNOPSIS

  use Inca::ReporterManager;
  use Inca::Config::Suite;
  use Inca::ReporterManager::ReporterCache;
  my $suite = new Inca::Config::Suite();
  $suite->read( "suite.xml" );
  my $scheduler = new Inca::ReporterManager();
  my $credentials = { cert => "t/certs/client_ca1cert.pem",
                      key => "t/certs/client_ca1keynoenc.pem",
                      passphrase => undef,
                      trusted => "t/certs/trusted" };
  $scheduler->setCredentials( $credentials );
  $scheduler->setCheckPeriod( 1 );
  $scheduelr->setDepots( "incas://localhost:$port" );
  my $rc = new Inca::ReporterManager::ReporterCache( "t" );
  $scheduler->setReporterCache( $rc );
  $scheduler->dispatch( $suite );

DESCRIPTION

This module implements the core functionality of the reporter manager. It receives requests from either a reporter agent or a local Inca administrator via its APIs indicating add/delete of a series config or store a package (e.g., a reporter, reporter library, or external dependency).

Each add/delete series config request indicates a reporter name and version, a set of input arguments, limits, frequency of execution, execution priority, a scheduler, and a storage policy (for now, a set of depots interested in the results). For example, if the reporter execution is on-demand, the scheduler hands the request to the Sequential scheduler. In many cases, the Cron scheduler will be requested, that is the reporter execution is scheduled and the frequency of execution is managed by an internal cron table. When the scheduled time for a reporter comes, a RIM is launched to run the reporter.

Each store package request is handled a bit differently based on the filename. See Inca::ReporterManager::ReporterCache for more information.

CLASS METHODS

new( %Options )

Class constructor which returns a new Inca::ReporterManager object. The constructor may be called with any of the following attributes.

Options:

checkPeriod

A positive integer indicating the period in seconds of which to check the reporter for exceeding resource limits [default: 2]

credentials

A reference to a hash array containing the credential information.

depotURIs

A list 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.

reporterCache

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

rimPath

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

tmpDir

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

dispatch( $suite )

Read add/delete reporter requests in suite and route to appropriate scheduler.

Arguments:

suite

An object of type Inca::Config::Suite containing add/delete series config requests

getCheckPeriod( )

Get the period for how often to check the reporter for exceeding its limits.

Returns:

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

getCredentials( )

Retrieve the security credentials.

Returns:

A reference to a hash array containing the paths to the security credentials.

getDepots( )

Retrieve the destination depots that are used to send the report on completion.

Returns:

An array of strings containing uris to depots [host:port, ...]

getDepotTimeout( )

Get the period in seconds of which to time out the connection to the depot

Returns:

A positive integer indicating the period in seconds of which to time out thec connection to the depot

getId( )

Get the resource identifier supplied by the reporter agent that the reporter manager will use to identify itself to the depot.

Returns:

A string indicating the id of the resource.

getReporterCache( )

Retrieve the reporter administrator to use in order to find a path to a local copy of a reporter (from its URI).

Returns:

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

getRimPath( )

Retrieve the path to the reporter-instance-manager script.

Returns:

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

getTmpDirectory( )

Retrieve the path to a temporary file space that Inca can use while executing reporters

Returns:

A string containing a path to a temporary file space.

hasScheduler( $scheduler )

Return true if the reporter manager is currently running the provided scheduler.

Returns:

A boolean indicating whether or not the reporter manager is running the provided scheduler.

hasTmpDirectory( )

Return true if a temporary file space has been set for Inca.

Returns:

A boolean indicating true if a temporary file space has been set; otherwise returns false.

setCheckPeriod( $secs )

Set the period for how often to check the reporter for exceeding its limits.

Arguments:

secs

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

setCredentials( \%credentials )

Specify the credentials to use.

Arguments:

credentials

A reference to a hash array containing the credential information.

setDepots( @depot_uris )

Specify the destination depots that are used to send the report on completion. 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.

Arguments:

depot_uris

Any number of strings containing a uri to a depot [host:port, ...]

setDepotTimeout( $secs )

Set the period for when the time has exceeded for sending the report to the depot.

Arguments:

secs

A positive integer indicating the period in seconds of which to time out the connection to the depot.

setId( $resourceId )

Set the resource identifier supplied by the reporter agent that the reporter manager will use to identify itself to the depot.

Arguments:

resourceId

A string indicating the id of the resource.

setLogger( )

Set a log file for the reporter-instance-managers.

setReporterCache( $reporter_cache )

Specify the reporter administrator to use in order to find a path to a local copy of a reporter (from its URI).

Arguments:

reporter_cache

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

setRimPath( $path )

Specify the path to the reporter-instance-manager script.

Arguments:

path

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

setTmpDirectory( $path )

Specify a temporary file space that Inca can use while executing reporters.

Arguments:

path

A string containing a path to a temporary file space

start( )

Start execution of the schedulers that require specific start/stop.

stop( )

Stop execution of the schedulers that require specific start/stop.

storePackage( $name, $filename, $version, $installpath, $dependencies, $tmpfilename )

Store the specified package into the reporter cache.

Arguments:

name

A string containing the name of the reporter.

filename

A string containing the filename that the package should be stored under.

version

A string containing the version of the package.

installpath

A string containing the directory the package should be stored under relative to the reporter cache location.

perms

A string of format "[0-7][0-7][0-7]" that can be used to set the permissions of the stored file after its written to disk. A value of undef means that no change of permissions is needed.

dependencies

A string containing a whitespace delimited list of dependencies or undef if there are none.

tmpfilename

A string containing the name of a temporary file that is storing the content of the package.

Returns: True if the package is succesfully cached in the reporter cache and false otherwise.

AUTHOR

Shava Smallen <ssmallen@sdsc.edu>

CAVEATS/WARNINGS

Does not recognize storage policies yet.

<<