Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > a89793aba17cc958d74bb76555095614 > files > 5

globus-gram-job-manager-scripts-doc-2.12-1.fc14.noarch.rpm

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Globus::GRAM::JobManager - Base class for all Job Manager scripts</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<!--

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<ul>

		<li><a href="#methods">Methods</a></li>
	</ul>

	<li><a href="#responses">RESPONSES</a></li>
</ul>

-->


</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Globus::GRAM::JobManager - Base class for all Job Manager scripts</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
 $manager = new Globus::GRAM::JobManager($job_description);</pre>
<pre>
 $manager-&gt;log(&quot;Starting new operation&quot;);
 $manager-&gt;nfssync($fileobj,$createflag);
 $manager-&gt;respond($hashref);
 $hashref = $manager-&gt;submit();
 $hashref = $manager-&gt;poll();
 $hashref = $manager-&gt;cancel();
 $hashref = $manager-&gt;signal();
 $hashref = $manager-&gt;make_scratchdir();
 $hashref = $manager-&gt;remove_scratchdir();
 $hashref = $manager-&gt;rewrite_urls();
 $hashref = $manager-&gt;stage_in();
 $hashref = $manager-&gt;stage_out();
 $hashref = $manager-&gt;cache_cleanup();
 $hashref = $manager-&gt;remote_io_file_create();
 $hashref = $manager-&gt;proxy_relocate();
 $hashref = $manager-&gt;proxy_update();
 $scalar  = $manager-&gt;pipe_out_cmd(@arglist);
 ($stderr, $rc) = $manager-&gt;pipe_err_cmd(@arglist);
 $status  = $manager-&gt;fork_and_exec_cmd(@arglist);
 $manager-&gt;append_path($hash, $variable, $path);
 $scalar = $manager-&gt;setup_softenv();</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>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.</p>
<p>
</p>
<h2><a name="methods">Methods</a></h2>
<dl>
<dt><strong><a name="new" class="item">$manager = Globus::GRAM::JobManager-&gt;<code>new($JobDescription)</code></a></strong></dt>

<dd>
<p>Each Globus::GRAM::JobManager object is created by calling the constructor
with a single argument, a Globus::GRAM::JobDescription object containing
the information about the job request which the script will be modifying.
Modules which subclass Globus::GRAM::JobManager MUST call the super-class's
constructor, as in this code fragment:</p>
<pre>
     my $proto = shift;
     my $class = ref($proto) || $proto;
     my $self = $class-&gt;SUPER::new(@_);</pre>
<pre>
     bless $self, $class;</pre>
</dd>
<dt><strong><a name="log" class="item">$manager-&gt;<code>log($string)</code></a></strong></dt>

<dd>
<p>Log a message to the job manager log file. The message is preceded by
a timestamp.</p>
</dd>
<dt><strong><a name="nfssync" class="item">$manager-&gt;<code>nfssync($object,$create)</code></a></strong></dt>

<dd>
<p>Send an NFS update by touching the file (or directory) in question. If the
$create is true, a file will be created. If it is false, the $object will
not be created.</p>
</dd>
<dt><strong><a name="respond" class="item">$manager-&gt;<code>respond($message)</code></a></strong></dt>

<dd>
<p>Send a response to the job manager program. The response may either be
a hash reference consisting of a hash of (variable, value) pairs, which will
be returned to the job manager, or an already formatted string.
This only needs to be directly called by a job manager implementation
when the script wants to send a partial response while processing one of
the scheduler interface methods (for example,
to indicate that a file has been staged).</p>
<p>The valid keys for a response are defined in the RESPONSES section.</p>
</dd>
<dt><strong><a name="submit" class="item">$manager-&gt;<code>submit()</code></a></strong></dt>

<dd>
<p>Submit a job request to the scheduler. The default implementation returns
with the Globus::GRAM::Error::UNIMPLEMENTED error. Scheduler specific
subclasses should reimplement this method to submit the job to the
scheduler.</p>
<p>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-&gt;{JobDescription}.</p>
<p>For example:</p>
<pre>
    return {JOB_STATE =&gt; Globus::GRAM::JobState::PENDING,
            JOB_ID =&gt; $job_id};</pre>
</dd>
<dt><strong><a name="poll" class="item">$manager-&gt;<code>poll()</code></a></strong></dt>

<dd>
<p>Poll a job's status. The default implementation returns
with the Globus::GRAM::Error::UNIMPLEMENTED error. Scheduler specific
subclasses should reimplement this method to poll the
scheduler.</p>
<p>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-&gt;{JobDescription}-&gt;<code>jobid()</code> method.</p>
</dd>
<dt><strong><a name="cancel" class="item">$manager-&gt;<code>cancel()</code></a></strong></dt>

<dd>
<p>Cancel a job. The default implementation returns
with the Globus::GRAM::Error::UNIMPLEMENTED error. Scheduler specific
subclasses should reimplement this method to remove the job
from the scheduler.</p>
<p>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-&gt;{JobDescription}-&gt;<code>jobid()</code> method.</p>
</dd>
<dt><strong><a name="signal" class="item">$manager-&gt;<code>signal()</code></a></strong></dt>

<dd>
<p>Signal a job. The default implementation returns
with the Globus::GRAM::Error::UNIMPLEMENTED error. Scheduler specific
subclasses should reimplement this method to remove the job
from the scheduler. The JobManager module can determine the job's ID,
the signal number, and the (optional) signal arguments from the
Job Description by calling it's <code>job_id()</code>, <a href="#signal"><code>signal()</code></a>, and and <code>signal_arg()</code>
methods, respectively.</p>
<p>Depending on the signal, it may be appropriate for the JobManager object
to return a hash reference containing a JOB_STATE update.</p>
</dd>
<dt><strong><a name="make_scratchdir" class="item">$manager-&gt;<code>make_scratchdir()</code></a></strong></dt>

<dd>
<p>Create a scratch directory for a job. The scratch directory location
is based on the JobDescription's <code>scratch_dir_base()</code> and <code>scratch_dir()</code> methods.</p>
<p>If the <code>scratch_dir()</code> 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 <code>scratch_dir()</code>.  This method will
return a hash reference containing mapping SCRATCH_DIR to the absolute
path of newly created scratch directory if successful.</p>
</dd>
<dt><strong>$manager-&gt;<code>make_scratchdir()</code></strong></dt>

<dd>
<p>Delete a job's scratch directory. All files and subdirectories of the
JobDescription's <code>scratch_directory()</code> will be deleted.</p>
</dd>
<dt><strong>$manager-&gt;<code>make_scratchdir()</code></strong></dt>

<dd>
<p>Delete some job-related files. All files listed in the JobDescription's
<code>file_cleanup()</code> array will be deleted.</p>
</dd>
<dt><strong><a name="rewrite_urls" class="item">$manager-&gt;<code>rewrite_urls()</code></a></strong></dt>

<dd>
<p>Looks up URLs listed in the JobDescription's <code>stdin()</code> and <code>executable()</code>, and
replaces them with paths to locally cached copies.</p>
</dd>
<dt><strong><a name="stage_in" class="item">$manager-&gt;<code>stage_in()</code></a></strong></dt>

<dd>
<p>Stage input files need for the job from remote storage. The files to
be staged are defined by the array of [URL, path] pairs in
the job description's <code>file_stage_in()</code> and <code>file_stage_in_shared()</code> 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.</p>
<p>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.</p>
</dd>
<dt><strong><a name="stage_out" class="item">$manager-&gt;<code>stage_out()</code></a></strong></dt>

<dd>
<p>Stage output files generated by this job to remote storage. The files to
be staged are defined by the array of [URL, destination] pairs in
the job description's <code>file_stage_out()</code> 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.</p>
</dd>
<dt><strong><a name="cache_cleanup" class="item">$manager-&gt;<code>cache_cleanup()</code></a></strong></dt>

<dd>
<p>Clean up cache references in the GASS which match this job's cache tag .</p>
</dd>
<dt><strong><a name="remote_io_file_create" class="item">$manager-&gt;<code>remote_io_file_create()</code></a></strong></dt>

<dd>
<p>Create the remote I/O file in the job dir which will contain the
remote_io_url RSL attribute's value.</p>
</dd>
<dt><strong><a name="proxy_relocate" class="item">$manager-&gt;<code>proxy_relocate()</code></a></strong></dt>

<dd>
<p>Relocate the delegated proxy for job execution. Job Managers need to
override the default if they intend to relocate the proxy into some
common file system other than the cache. The job manager program does
not depend on the new location of the proxy. Job Manager modules must
not remove the default proxy.</p>
</dd>
<dt><strong><a name="proxy_update" class="item">$hashref = $manager-&gt;<code>proxy_update()</code>;</a></strong></dt>

<dt><strong><a name="append_path" class="item">$manager-&gt;append_path($ref, $var, $path)</a></strong></dt>

<dd>
<p>Append $path to the value of $ref-&gt;{$var}, dealing with the case where
$ref-&gt;{$var} is not yet defined.</p>
</dd>
<dt><strong><a name="pipe_out_cmd" class="item">$manager-&gt;<code>pipe_out_cmd(@arg)</code></a></strong></dt>

<dd>
<p>Create a new process to run the first argument application with the 
remaining arguments (which may be empty). No shell metacharacter will
be evaluated, avoiding a shell invocation. Stderr is redirected to 
/dev/null and stdout is being captured by the parent process, which
is also the result returned.  In list mode, all lines are
returned, in scalar mode, only the first line is being returned. The
line termination character is already cut off. Use this function as
more efficient backticks, if you do not need shell metacharacter
evaluation.</p>
<p>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.</p>
<p>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.</p>
</dd>
<dt><strong><a name="pipe_err_cmd" class="item">($stder, $rc) = $manager-&gt;<code>pipe_err_cmd(@arg)</code></a></strong></dt>

<dd>
<p>Create a new process to run the first argument application with the 
remaining arguments (which may be empty). No shell metacharacter will
be evaluated, avoiding a shell invocation.</p>
<p>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.</p>
</dd>
<dt><strong><a name="fork_and_exec_cmd" class="item">$manager-&gt;<code>fork_and_exec_cmd(@arg)</code></a></strong></dt>

<dd>
<p>Fork off a child to run the first argument in the list. Remaining arguments
will be passed, but shell interpolation is avoided. Signals SIGINT and
SIGQUIT are ignored in the child process. Stdout is appended to /dev/null,
and stderr is dup2 from stdout. The parent waits for the child to finish,
and returns the value for the CHILD_ERROR variable as result. Use this
function as more efficient <code>system()</code> call, if you can do not need shell
metacharacter evaluation.</p>
<p>Note that the inability to execute the program will result in a status code
of 127.</p>
</dd>
<dt><strong><a name="job_dir" class="item">$manager-&gt;<code>job_dir()</code></a></strong></dt>

<dd>
<p>Return the temporary directory to store job-related files, which have no
need for file caching.</p>
</dd>
<dt><strong><a name="setup_softenv" class="item">$manager-&gt;<code>setup_softenv()</code></a></strong></dt>

<dd>
<p>Either add a line to the specified command script file handle to load the user's
default SoftEnv configuration, or create a custom SoftEnv script and
add commands to the specified command script file handle to load it.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="responses">RESPONSES</a></h1>
<p>When returning from a job interface method, or when sending an intermediate
response via the <em>response</em>() method, the following hash keys are valid:</p>
<ul>
<li><strong><a name="job_state" class="item">JOB_STATE</a></strong>

<p>An integer job state value. These are enumerated in the Globus::GRAM::JobState
module.</p>
</li>
<li><strong><a name="error" class="item">ERROR</a></strong>

<p>An integer error code. These are enumerated in the Globus::GRAM::Error module.</p>
</li>
<li><strong><a name="job_id" class="item">JOB_ID</a></strong>

<p>A string containing a job identifier, which can be used to poll, cancel, or
signal a job in progress. This response should only be returned by the
<em>submit</em> method.</p>
</li>
<li><strong><a name="scratch_dir" class="item">SCRATCH_DIR</a></strong>

<p>A string containing the path to a newly-created scratch directory. This
response should only be returned by the <em>make_scratchdir</em> method.</p>
</li>
<li><strong><a name="staged_in" class="item">STAGED_IN</a></strong>

<p>A string containing the (URL, path) pair for a file which has now been staged
in. This response should only be returned by the <em>stage_in</em> method.</p>
</li>
<li><strong><a name="staged_in_shared" class="item">STAGED_IN_SHARED</a></strong>

<p>A string containing the (URL, path) pair for a file which has now been staged
in and symlinked from the cache. This response should only be returned by the
<em>stage_in_shared</em> method.</p>
</li>
<li><strong><a name="staged_out" class="item">STAGED_OUT</a></strong>

<p>A string containing the (path, URL) pair for a file which has now been staged
out by the script. This response should only be returned by the
<em>stage_out</em> method.</p>
</li>
</ul>

</body>

</html>