NAME

LSF::JobGroup - manipulate LSF job groups

SYNOPSIS

use LSF::JobGroup;

use LSF::JobGroup PRINT => 1;

$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

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 1 on success, 0 on failure. Sets $? and $@;

$jobgroup->delete

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

$jobgroup->hold

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

$jobgroup->release

Releases a LSF job group. Pending jobs are free to run. Returns 1 on success, 0 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 => "done($job1) && finished($job2)" ); $jobgroup->modify(-w => "done($job1) && finished($job2)" );

$jobgroup->jobs

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.

SEE ALSO

LSF, LSF::Job, bgadd, bgrel, bghold, bgrel, bgmod, bjobs

BUGS

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.

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)