LSF::JobGroup - manipulate LSF job groups
use LSF::JobGroup;
use LSF::JobGroup RaiseError => 0, PrintError => 1, PrintOutput => 0;
$jobgroup = LSF::JobGroup->new( [GROUP_NAME] );
...
$jobgroup->add( [ARGS] ) unless $jobgroup->exists;
$jobgroup->delete;
$jobgroup->hold;
$jobgroup->release; ... $jobgroup->modify(-w => 'exited(/mygroup/,==0)' ); ... @jobs = $jobgroup->jobs('-r'); ... etc ...
LSF::JobGroup is a wrapper arround the LSF b* commands used to manipulate job groups. for a description of how the LSF commands work see the man pages of:
LSF::JobGroup
bgadd bgdel bghold bgrel bgmod bjobs
LSF
$jobgroup = LSF::JobGroup->new('/MyGroup');
Creates a new LSF::JobGroup object.
Required argument is a job group name. This can be a single group name or a path, much like a filesystem path. This does not *have* to exist in the system as new job groups can be created. Names should only contain alphanumeric characters plus '_' and '-'. Not only my code but also LSF job dependancy expressions will fail if you attempt otherwise.
id returns 1 if the job group exists, 0 otherwise. The method attempts to create the group and if it fails it examines the LSF output to see if the group existed. I couldn't find a better test to use. Answers on a postcard...
id
Adds a job group, or group path. Returns true on success, false on failure. Sets $? and $@;
Deletes a job group. Returns true on success, false on failure. Sets $? and $@;
Holds a LSF job group. All pending jobs will wait until the group is released. Returns true on success, false on failure. Sets $? and $@;
Releases a LSF job group. Pending jobs are free to run. Returns true on success, false on failure. Sets $? and $@;
Modifies the LSF job group. For example, changing its name or its dependancy expression. See the bgmod man page.
$jobgroup->modify(-w => "started($jobgroup,==0)" ); $jobgroup->modify(-w => "ended($jobgroup,==0)" );
Returns an list of LSF::Job objects of jobs contained within this job group. Remember to use the '-r' flag if you want to include jobs in sub groups.
The use of the '-l' flag of the LSF command lines can be considered a bug. Using group 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::Job, bgadd, bgdel, bghold, bgrel, bgmod, bjobs
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.