LSF::Job - create and manipulate LSF jobs
use LSF::Job;
use LSF::Job RaiseError => 0, PrintError => 1, PrintOutput => 0;
$job = LSF::Job->new(123456);
...
$job = LSF::Job->submit(-q => 'default' ,-o => '/dev/null' ,"echo hello");
$job2 = LSF::Job->submit(-q => 'default' ,-o => '/home/logs/output.txt' ,"echo world!");
@jobs = LSF::Job->jobs( -J => "/mygroup/*" );
$job2->modify(-w => "done($job)" );
$job2->del(-n => 1);
$job->top();
$job->bottom();
$exit = $job->history->exit_status;
... etc ...
LSF::Job is a wrapper arround the LSF b* commands used to submit and manipulate jobs. for a description of how the LSF commands work see the man pages of:
LSF::Job
bsub bbot bchkpnt bkill bmig bmod brequeue brestart bresume bstop bswitch btop
LSF
Creates a new LSF::Job object.
Required argument is a LSF jobid. This does not *have* to exist in the system but would probably be a good idea!
Arguments are the LSF parameters normally passed to 'bsub'.
Required parameter is the command line (as a string) that you want to execute.
Creates an array of LSF::Job objects corresponding to jobs that match the query
Arguments are the LSF parameters normally passed to 'bjobs'.
id returns the jobid of the LSF Job. This is particularly useful when building up job interdependencies
id
Returns a LSF::JobHistory object with information about the LSF job. See the LSF::JobHistory perldoc page.
Moves the LSF job to the bottom of its queue. See the bbot man page. Returns true on success, false on failure. Sets $? and $@;
Checkpoints a checkpointable job. See the bchkpnt man page. Returns true on success, false on failure. Sets $? and $@;
*** Deprecated in LSF 5.0. Use kill instead. ***
Deletes the LSF job from the system. See the bdel man page. Returns true on success, false on failure. Sets $? and $@;
Kills the LSF job. See the bkill man page. Returns true on success, false on failure. Sets $? and $@;
Migrates the LSF job. See the bmigrate man page. Returns true on success, false on failure. Sets $? and $@;
Modifies the LSF job. See the bmod man page. Since the objects are overloaded to return the job id when used in string context this allows easy build up of job dependancies e.g. Returns true on success, false on failure. Sets $? and $@;
$job3->modify(-w => "done($job1) && done($job2)" );
Restarts a checkpointed job. See the brestart man page. Returns true on success, false on failure. Sets $? and $@;
Resumes a suspended job. See the bresume man page. Returns true on success, false on failure. Sets $? and $@;
Starts the LSF job now. See the brun man page. Returns true on success, false on failure. Sets $? and $@;
Stops the LSF job. See the bstop man page. Returns true on success, false on failure. Sets $? and $@;
Switches the LSF job between LSF queues. See the bswitch man page. Returns true on success, false on failure. Sets $? and $@;
Moves the LSF job to the top of its queue. See the btop man page. Returns true on success, false on failure. Sets $? and $@;
The use of the '-l' flag of the LSF command lines can be considered a bug. Using LSF job names with non alphabetic characters can also be considered a bug. Otherwise, please report them.
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.
LSF, LSF::JobHistory, bsub, bhist, bswitch, bdel, bkill, bstop, bmod, btop, bbot, brun
Mark Southern (mark_southern@merck.com)
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)
To install LSF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LSF
CPAN shell
perl -MCPAN -e shell install LSF
For more information on module installation, please visit the detailed CPAN module installation guide.