Submit API

SYNOPSIS

use IBM::Loadleveler
 
# Submit API function
 
$job_name,$owner,$groupname,$uid,$gid,$submit_host,$numsteps,$ref)=llsubmit($job_cmd_file,$monitor_program,
                                                                                          $monitor_args);

DESCRIPTION

On successful submission this function returns a `perlised' version of the LL_job structure. See the llsubmit example and the LoadLeveler API header file llapi.h for full information on how to use it. Currently the following LL_job_step structure members are not returned:

usage_info64
adapter_req

llfree_job_info is not implemented because it is done by in the llsubmit call after the data has been transfered to Perl.

A minimal example of using the Submit API is:

use IBM::LoadLeveler;
 
my ($job_name,$owner,$group,$uid,$gid,$host,$steps,$job_step)=llsubmit("/home/mike/test_job/test_job.cmd",NULL,NULL);
 
print "Job Name   = $job_name\n";
print "Owner      = $owner\n";
print "Group      = $group\n";
print "UID        = $uid\n";
print "GID        = $gid\n";
print "HOST       = $host\n";
print "STEPS      = $steps\n";
print "JOB_STEP   = $job_step\n";
@steps=@{$job_step};
print "JOB_STEP   = $#{$job_step}\n";
foreach $stepref  (@steps)
{
    %step=%{$stepref};
    print "STEP_NAME      = $step{'step_name'}\n";
    print "REQUIREMENTS   = $step{'requirements'}\n";
    %usage_info = %{$step{'usage_info'}};
    print "USAGE INFO     = --------------------\n";
    print "	STARTER_RUSAGE = $usage_info{'starter_rusage'}\n";
    %rusage=%{$usage_info{'starter_rusage'}};
    print "		RU_UTIME  = $rusage{'ru_utime'}\n";
    print "		RU_MAXRSS = $rusage{'ru_maxrss'}\n";
    print "	STEP_RUSAGE    = $usage_info{'step_rusage'}\n";
    print "	MACH_USAGE ITEMS = $#{$usage_info{'mach_usage'}}\n";
}

llsubmit

($job_name,$owner,$groupname,$uid,$gid,$submit_host,$numsteps,$ref)=llsubmit($job_cmd_file,$monitor_program,
                                                                                           $monitor_args);

Parameters

ParameterDescription
$job_cmd_fileA string containing the name of the Job Command File
$monitor_programIs a pointer to a string containing the name of the monitor program to be invoked when the state of the job is changed. Set to NULL if a monitoring program is not provided.
$monitor_argsA string (maximum length 1023 characters) that is passed to the monitor program

An example of a basic monitor program is:

#!/usr/bin/perl
 
open(MAILOUT,"|mail -s '$jobstep Changed State' guest");
print MAILOUT "\n";
print MAILOUT "@ARGV\n";
print MAILOUT "\n";
close(MAILOUT);

This will get called when the job changes to one of the following states:

Flag Condition
JOB_STARTED The job step has started.
JOB_COMPLETED The job step has completed.
JOB_VACATED The job step has been vacated. The job step will be rescheduled if the job step is restartable or if it is checkpointable.
JOB_REJECTEDA startd daemon has rejected the job. The job will be rescheduled to another machine if possible.
JOB_REMOVEDThe job step was canceled or could not be started.
JOB_NOTRUN The job step cannot be run because a dependency cannot be met.

Returns

The function returns:

  • $job_name
  • $owner
  • $groupname
  • $uid
  • $gid
  • $submit_host
  • $numsteps
  • $ref

$ref is a reference to an array of job step information, each job step is a hash, the key is the name of the element in the LL_job_step structure, eg:

@steps = @{$ref};
foreach $stepref ( @steps )
{
	%step=%{stepref};
	print "STEP_NAME      = $step{'step_name'}\n";
	print "REQUIREMENTS   = $step{'requirements'}\n";
	print "PREFERENCES    = $step{'preferences'}\n";
}
 
submit_api.txt · Last modified: 2007/09/14 07:50 by mike
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki