Module xg :: Class Grid
[show private | hide private]
[frames | no frames]

Class Grid

JobManager --+
             |
            Grid


A class for working with jobs on a specific Xgrid grid.
Method Summary
  __init__(self, gridID, connection, update)
This class provides an interface to an Xgrid grid.
  __repr__(self)
Job batch(self, specification)
Submits a batch job to the current grid.
  info(self, update)
Job submit(self, cmd, args, stdin, indir, email)
Submits a single task job to the current grid.
    Inherited from JobManager
  deleteAll(self)
Deletes all active jobs.
  job(self, jobID, update)
Returns the Job object with job identifier id.
tuple jobIDs(self, update)
Returns a tuple of job identifiers for all active jobs.
list jobs(self, update)
Returns a list of initialized Job objects for all active jobs.
  perform(self, action, jobIDs)
Performs an action on a subset of active jobs.
  printJobs(self)
Prints information about all active Xgrid jobs.
  restartAll(self)
Restarts all active jobs.
  resumeAll(self)
Resumes all active jobs.
  stopAll(self)
Stops all active jobs.
  suspendAll(self)
Suspends all active jobs.

Method Details

__init__(self, gridID=u'0', connection=None, update=0)
(Constructor)

This class provides an interface to an Xgrid grid.

An Xgrid grid is a collection of agents and jobs running on the agents. This class provides access to the jobs running on a grid. Currently, Xgrid does not expose an API for working directly with the agents in a grid.

Instances of this class can be obtained using two methods.
  1. By calling the grid() or grids() methods of the GridManager or Controller classes.
  2. By creating a new Grid object directly with a valid gridID:
>>> g = Grid(u'0')
Parameters:
gridID - The grid identifier of the grid. If gridID is empty the default grid (u'0') will be used.
           (type=unicode, int or str)
connection - Instance of Connection class. If empty a default Connection object is used.
           (type=Connection)
update - A boolean flag that determines whether or not the internal state is updated upon creation. This involves a call to the Xgrid controller.
           (type=boolean)
Overrides:
xg.JobManager.__init__

batch(self, specification)

Submits a batch job to the current grid.

This is a nonblocking job submission method used for submitting complex multi-task jobs. For single task jobs, use submit().

To retrieve job results, use the results() method of the Job class.
Parameters:
specification - The job specification of the job, which must be an instance of the JobSpecification class. See the docstring for JobSpecification for more details.
           (type=JobSpecification)
Returns:
Initialized Job object for sumbitted job.
           (type=Job)

submit(self, cmd, args='', stdin='', indir='', email='')

Submits a single task job to the current grid.

This is a nonblocking job submission method for a single job with no sub-tasks. For more complicated jobs with sub-tasks, use the batch() method and the JobSpecification class.

Job results can be obtained by calling the results() method of the Job object.
Parameters:
cmd - The command the execute as a string. The executable is not copied if the full path is given, otherwise it is.
           (type=str)
args - The command line arguments to be passed to the command.
           (type=list or str)
stdin - A local file to use as the stdin stream for the job.
           (type=str)
indir - A local directory to copy to the remote agent.
           (type=str)
email - An email to which notification will be send of various job state changes.
           (type=str)
Returns:
Initialized Job object for sumbitted job.
           (type=Job)

Generated by Epydoc 2.1 on Thu Dec 22 15:15:21 2005 http://epydoc.sf.net