NAME

McFeely::Task - Perl class that represents McFeely tasks.


SYNOPSIS

  use McFeely::Job;
  use McFeely::Task;
  $task1 = McFeely::Task->new($host1, $command1, @args1);
  $task2 = McFeely::Task->new($host2, $command2, @args2);
  $job = McFeely::Job->new($task1, $task2);
  $job->add_dependencies($task2->requires($task1));
  $job->enqueue or die $job->errstr, "\n";

  use McFeely::Task ':all';
  ...
  ok 'Task complete, exiting.';
  hard 'Task failed, don't try again.';
  soft 'Temporary failure, defer execution til later.';


DESCRIPTION

McFeely tasks.


METHODS

new( HOST, COMMAND, ARGS )

Creates a McFeely::Task.

New validates the HOST and COMMAND. The host is checked to see that the string is there and if it is drives it back to a fully qualified domain name. COMMAND is checked to be sure that the string exists and has content. If either HOST or COMMAND are not proper then new() will die. If you call new in an eval you can trap the dies and process $@. $@ will begin with 'hostname:' if the hostname is no good; 'comm:' if the COMMAND is no good.

comm

Return the name of the comm for this task. This does not assert anything about the existence of or appropriateness of the comm itself, just gives what is stored in this task.

requires( TASK, [TASK, ...] )

Returns a REQUIREMENT. This requirement can then be fed to the McFeely::Job add_dependencies method to add this requirement to a given job.

hard ( [MESSAGE] )

Logs MESSAGE, if provided, then returns with the EXIT_HARD code, meaning the task has suffered a permanent failure.

soft ( [MESSAGE] )

Logs MESSAGE, if provided, then returns with the EXIT_SOFT code, meaning the task encountered a temporary problem and execution should be retried later.

ok ( [MESSAGE] )

Logs MESSAGE, if provided, then returns with the EXIT_OK code.


SEE ALSO

McFeely::Job, McFeely::Metatask


AUTHORS

Matt Liggett <mml@pobox.com>, Adrian Hosey <ahosey@systhug.com>, Chris Dent <cdent@kiva.net>