Graham Bell > WWW-Crab-Client-0.02 > WWW::Crab::Client

Download:
WWW-Crab-Client-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.02   Source   Latest Release: WWW-Crab-Client-0.06

NAME ^

WWW::Crab::Client - Crab client library

SYNOPSIS ^

  use WWW::Crab::Client;

  my $crab = new WWW::Crab::Client();

  eval {
      $crab->start();
  };

  # Perform the cron job actions ...

  my $finished_ok = eval {
      $crab->finish(status => WWW::Crab::Client::SUCCESS, stdout => $message);
  };
  unless ($finished_ok) {
      print "Failed to report job completion.\n" . $@ . "\n" . $message;
  }

DESCRIPTION ^

This module implements a subset of the Crab protocol sufficient for reporting the status of a cron job to the Crab server. It is intended to work similarly to the Python Crab client module, but be more convient for cron jobs written in Perl.

CONSTRUCTOR ^

new()

Constructs a new client object. All parameters are optional. If no job identifier is given, then a null value is sent to the server. If the command is unspecified, $0 will be used. No communication is performed until the start or finish methods are called.

  my $crab = new WWW::Crab::Client(id       => 'job identifier',
                                   command  => 'command name',
                                   server   => 'localhost',
                                   port     => 8000,
                                   hostname => 'localhost',
                                   username => 'username');

If the other settings are not specified, the crab settings files will be read, the CRABHOST and CRABPORT environment variables will be checked, or defaults will be used.

METHODS ^

start()

Reports that the job has started.

  $crab->start();

This method uses "die" to raise an exception if it is unsuccessful in reporting to the Crab server.

Returns a true value on success.

finish()

Reports that the job has finished. If the status is not specified, UNKNOWN will be sent.

  $crab->finish(status => WWW::Crab::Client::SUCCESS,
                stdout => $command_output,
                stderr => $error_message);

The following constants are defined in this module, and should be used to obtain the appropriate Crab status codes:

  SUCCESS
  FAIL
  UNKNOWN
  COULDNOTSTART

This method uses "die" to raise an exception if it is unsuccessful in reporting to the Crab server.

Returns a true value on success.

AUTHOR ^

Graham Bell <g.bell@jach.hawaii.edu>

COPYRIGHT ^

Copyright (C) 2012 Science and Technology Facilities Council.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

syntax highlighting: