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

NAME

LSF::Job - create and manipulate LSF jobs

SYNOPSIS

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

DESCRIPTION

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:

    bsub bbot bchkpnt bkill bmig bmod brequeue brestart bresume bstop bswitch btop

INHERITS FROM

LSF

CONSTRUCTORS

new ( [NUM] )

$job = LSF::Job->new(123456);

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!

submit ( [ [ARGS] ], [COMMAND_STRING] )

$job = LSF::Job->submit(-q => 'default' ,-o => '/dev/null' ,"echo hello");

Creates a new LSF::Job object.

Arguments are the LSF parameters normally passed to 'bsub'.

Required parameter is the command line (as a string) that you want to execute.

jobs ( [ARGS] )

@jobs = LSF::Job->jobs( -J => "/mygroup/*" );

Creates an array of LSF::Job objects corresponding to jobs that match the query

Arguments are the LSF parameters normally passed to 'bjobs'.

METHODS

$job->id() (or object in string context)

id returns the jobid of the LSF Job. This is particularly useful when building up job interdependencies

$job->history

Returns a LSF::JobHistory object with information about the LSF job. See the LSF::JobHistory perldoc page.

$job->bottom

Moves the LSF job to the bottom of its queue. See the bbot man page. Returns true on success, false on failure. Sets $? and $@;

$job->checkpoint

Checkpoints a checkpointable job. See the bchkpnt man page. Returns true on success, false on failure. Sets $? and $@;

$job->delete( [ARGS] )

*** 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 $@;

$job->kill

Kills the LSF job. See the bkill man page. Returns true on success, false on failure. Sets $? and $@;

$job->migrate

Migrates the LSF job. See the bmigrate man page. Returns true on success, false on failure. Sets $? and $@;

$job->modify( [ARGS] )

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

$job->restart

Restarts a checkpointed job. See the brestart man page. Returns true on success, false on failure. Sets $? and $@;

$job->resume

Resumes a suspended job. See the bresume man page. Returns true on success, false on failure. Sets $? and $@;

$job->run

Starts the LSF job now. See the brun man page. Returns true on success, false on failure. Sets $? and $@;

$job->stop

Stops the LSF job. See the bstop man page. Returns true on success, false on failure. Sets $? and $@;

$job->switch( [ARGS] )

Switches the LSF job between LSF queues. See the bswitch man page. Returns true on success, false on failure. Sets $? and $@;

$job->top

Moves the LSF job to the top of its queue. See the btop man page. Returns true on success, false on failure. Sets $? and $@;

BUGS

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.

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::JobHistory, bsub, bhist, bswitch, bdel, bkill, bstop, bmod, btop, bbot, brun

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)