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

NAME

LSF::JobGroup - manipulate LSF job groups

SYNOPSIS

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 ...

DESCRIPTION

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:

    bgadd bgdel bghold bgrel bgmod bjobs

INHERITS FROM

LSF

CONSTRUCTOR

new ( [NUM] )

$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.

METHODS

$jobgroup->exists

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...

$jobgroup->add

Adds a job group, or group path. Returns true on success, false on failure. Sets $? and $@;

$jobgroup->delete

Deletes a job group. Returns true on success, false on failure. Sets $? and $@;

$jobgroup->hold

Holds a LSF job group. All pending jobs will wait until the group is released. Returns true on success, false on failure. Sets $? and $@;

$jobgroup->release

Releases a LSF job group. Pending jobs are free to run. Returns true on success, false on failure. Sets $? and $@;

$job->modify([ARGS])

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)" );

$jobgroup->jobs([[ARGS]])

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.

BUGS

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.

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, bgadd, bgdel, bghold, bgrel, bgmod, bjobs

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)