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

NAME

LSF::JobManager - submit and wait for a set of LSF Jobs

SYNOPSIS

    use LSF RaiseError => 0, PrintError => 1, PrintOutput => 0;
    use LSF::JobManager;

    my $m = LSF::JobManager->new(-q=>'small');

    my $job = $m->submit("echo hello");
    $m->submit("echo world");
    
    for my $job ($m->jobs){
        $job->top;
    }
    
    $m->wait_all_children( history => 1 );
    print "All children have completed!\n";

    for my $job ($m->jobs){ # much quicker if history is pre-cached
        print STDERR "$job exited non zero\n" if $job->history->exit_status != 0;
    }
    
    $m->clear; # clear out the job manager to reuse.

DESCRIPTION

LSF::JobManager provides a simple mechanism to submit a set of command lines to the LSF Batch system and then wait for them all to finish in a blocking (efficient) manner.

INHERITS FROM

LSF

CONSTRUCTOR

new ( [ ARGS ] )

$manager = LSF::JobManager->new(-q=>'small' ,-m=>'mymachine');

Creates a new LSF::JobManager object.

Any parameters are used as defaults passed to the submit method.

METHODS

$manager->submit( [ [ ARGS ] ], [CMD] )

Submits a command line to LSF. This is a wrapper around the LSF::Job->submit call. The required argument is the command line to submit. Optional arguments override the defaults given to new. The submitted LSF::Job object is returned on success, otherwise undef is returned, $? and $@ set. See LSF::Job

$manager->wait_all_children( [ depend => DEPENDANCY, history => 1 ] )

Waits for all previously submitted LSF Jobs to complete in a blocking manner.

If a dependancy expression is provided then this is used in preference to an autogenerated dependancy based on the job id's of all the submitted jobs. In conjunction with named jobs ( the -J flag ) this can be used to get around the shell arg length limit which can be hit by extremely long dependancy expressions. See the bsub documentation for details of job names and depenancy expressions.

If the history flag is used to pass a true value then after all jobs have completed the history of each job is fetched in batch. It is much quicker this way than fetching each job history separately. The time taken is still significant however. If you do not intend to check the exit status or the command line or any other property of the Job::History object then it is worth passing a false value and avoiding the overhead.

$manager->params( [ [ PARAMS ] ] )

Sets the default submission parameters.

$manager->jobs()

Returns an array of the submitted LSF::Job objects.

$manager->clear()

Empties the job array so that the manager can be reused. Returns an array of the jobs removed.

HISTORY

The LSF::Batch module on cpan didn't compile easily on all platforms i wanted. The LSF API didn't seem very perlish either. As a quick fix I knocked these modules together which wrap the LSF command line interface. It was enough for my simple usage. Hopefully they work in a much more perly manner.

SEE ALSO

LSF, LSF::Job

AUTHOR

Mark Southern (mark_southern@merck.com)

COPYRIGHT

Copyright (c) 2002, Merck & Co. Inc. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 244:

You forgot a '=back' before '=head1'