Globus::GRAM::JobManager - Base class for all Job Manager scripts
$manager = new Globus::GRAM::JobManager($job_description);
$manager->log("Starting new operation"); $manager->nfssync($fileobj,$createflag); $manager->respond($hashref); $hashref = $manager->submit(); $hashref = $manager->poll(); $hashref = $manager->cancel(); $hashref = $manager->signal(); $hashref = $manager->make_scratchdir(); $hashref = $manager->remove_scratchdir(); $hashref = $manager->rewrite_urls(); $hashref = $manager->stage_in(); $hashref = $manager->stage_out(); $hashref = $manager->cache_cleanup(); $hashref = $manager->remote_io_file_create(); $hashref = $manager->proxy_relocate(); $hashref = $manager->proxy_update(); $scalar = $manager->pipe_out_cmd(@arglist); ($stderr, $rc) = $manager->pipe_err_cmd(@arglist); $status = $manager->fork_and_exec_cmd(@arglist); $manager->append_path($hash, $variable, $path);
The Globus::GRAM::JobManager module implements the base behavior for a Job Manager script interface. Scheduler-specific job manager scripts must inherit from this module in order to be used by the job manager.
new($JobDescription)
my $proto = shift; my $class = ref($proto) || $proto; my $self = $class->SUPER::new(@_);
bless $self, $class;
log($string)
nfssync($object,$create)
respond($message)
The valid keys for a response are defined in the RESPONSES section.
submit()
A scheduler which implements this method should return a hash reference containing a scheduler-specific job identifier as the value of the hash's JOB_ID key, and optionally, the a GRAM job state as the value of the hash's JOB_STATE key if the job submission was successful; otherwise a Globus::GRAM::Error value should be returned. The job state values are defined in the Globus::GRAM::JobState module. The job parameters (as found in the job rsl) are defined in Globus::GRAM::Jobdescription object in $self->{JobDescription}.
For example:
return {JOB_STATE => Globus::GRAM::JobState::PENDING, JOB_ID => $job_id};
poll()
A scheduler which implements this method should return a hash reference
containing the JOB_STATE value. The job's ID can be accessed by calling the
$self->{JobDescription}->jobid()
method.
cancel()
A scheduler which implements this method should return a hash reference
containing the JOB_STATE value. The job's ID can be accessed by calling the
$self->{JobDescription}->jobid()
method.
signal()
signal_arg()
methods, respectively.
Depending on the signal, it may be appropriate for the JobManager object to return a hash reference containing a JOB_STATE update.
make_scratchdir()
scratch_dir_base()
and scratch_dir()
methods.
If the scratch_dir()
value is a relative path, then a directory will be
created as a subdirectory of scratch_dir_base()/scratch_dir(), otherwise,
it will be created as a subdirectory of scratch_dir(). This method will
return a hash reference containing mapping SCRATCH_DIR to the absolute
path of newly created scratch directory if successful.
make_scratchdir()
scratch_directory()
will be deleted.
make_scratchdir()
file_cleanup()
array will be deleted.
rewrite_urls()
stdin()
and executable(), and
replaces them with paths to locally cached copies.
stage_in()
file_stage_in()
and file_stage_in_shared()
methods.
The Globus::GRAM::JobManager module provides an implementation of this
functionality using the globus-url-copy and globus-gass-cache programs.
Files which are staged in are not automatically removed when the job
terminates.
This function returns intermediate responses using the Globus::GRAM::JobManager::response() method to let the job manager know when each individual file has been staged.
stage_out()
file_stage_out()
method. The Globus::GRAM::JobManager
module provides an implementation of this functionality using the
globus-url-copy program. Files which are staged out are not removed by this
method.
cache_cleanup()
remote_io_file_create()
proxy_relocate()
pipe_out_cmd(@arg)
Caution: This function deviates in two manners from regular backticks. Firstly, it chomps the line terminator from the output. Secondly, it returns only the first line in scalar context instead of a multiline concatinated string. As with regular backticks, the result may be undefined in scalar context, if no result exists.
A child error code with an exit code of 127 indicates that the application could not be run. The scalar result returned by this function is usually undef'ed in this case.
pipe_err_cmd(@arg)
This method returns a list of two items, the standard error of the program, and the exit code of the program. If the error code is 127, then the application could not be run. Standard output is discarded.
fork_and_exec_cmd(@arg)
system()
call, if you can do not need shell
metacharacter evaluation.
Note that the inability to execute the program will result in a status code of 127.
job_dir()
When returning from a job interface method, or when sending an intermediate response via the response() method, the following hash keys are valid: