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

Class Grid

source code

object --+    
         |    
JobManager --+
             |
            Grid

A class for working with jobs on a specific Xgrid grid.

Instance Methods [hide private]
 
__init__(self, gridID=u'0', connection=None, update=0)
This class provides an interface to an Xgrid grid.
source code
 
_update(self) source code
 
_updateInfo(self) source code
 
_checkGridID(self, result, gridID)
Checks a dictionary for an InvalidGridIdentifier error.
source code
 
info(self, update=1)
Return the current status information about a grid.
source code
Job
submit(self, cmd, args='', stdin='', indir='', email='')
Submits a single task job to the current grid.
source code
Job
batch(self, specification)
Submits a batch job to the current grid.
source code
 
__repr__(self)
repr(x)
source code

Inherited from JobManager: deleteAll, job, jobIDs, jobs, perform, printJobs, restartAll, resumeAll, stopAll, suspendAll

Inherited from JobManager (private): _updateJobs

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

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 (unicode, int or str) - The grid identifier of the grid. If gridID is empty the default grid (u'0') will be used.
  • connection (Connection) - Instance of Connection class. If empty a default Connection object is used.
  • update (boolean) - A boolean flag that determines whether or not the internal state is updated upon creation. This involves a call to the Xgrid controller.
Overrides: object.__init__

_checkGridID(self, result, gridID)

source code 

Checks a dictionary for an InvalidGridIdentifier error.

Overrides: JobManager._checkGridID
(inherited documentation)

info(self, update=1)

source code 

Return the current status information about a grid.

The grid info is a dictionary of keys describing the current state of the grid.

Parameters:
  • update (boolean) - A boolean flag that determines whether or not the internal state is updated upon creation. This involves a call to the Xgrid controller.

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

source code 

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 (str) - The command the execute as a string. The executable is not copied if the full path is given, otherwise it is.
  • args (list or str) - The command line arguments to be passed to the command.
  • stdin (str) - A local file to use as the stdin stream for the job.
  • indir (str) - A local directory to copy to the remote agent.
  • email (str) - An email to which notification will be send of various job state changes.
Returns: Job
Initialized Job object for sumbitted job.

batch(self, specification)

source code 

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 (JobSpecification) - The job specification of the job, which must be an instance of the JobSpecification class. See the docstring for JobSpecification for more details.
Returns: Job
Initialized Job object for sumbitted job.

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)