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

Class JobManager

source code

object --+
         |
        JobManager
Known Subclasses:

Manage a set of Xgrid jobs.

Instance Methods [hide private]
 
__init__(self, gridID=u'0', connection=None, update=0)
Create a JobManager for a given Grid and Connection.
source code
 
_updateJobs(self)
Updates the _jobIDs and _jobs instance variables.
source code
 
_checkGridID(self, result, gridID)
Checks a dictionary for an InvalidGridIdentifier error.
source code
list
jobs(self, update=1)
Returns a list of initialized Job objects for all active jobs.
source code
 
job(self, jobID=u'999999999', update=1)
Returns the Job object with job identifier id.
source code
tuple
jobIDs(self, update=1)
Returns a tuple of job identifiers for all active jobs.
source code
 
perform(self, action, jobIDs)
Performs an action on a subset of active jobs.
source code
 
stopAll(self)
Stops all active jobs.
source code
 
suspendAll(self)
Suspends all active jobs.
source code
 
resumeAll(self)
Resumes all active jobs.
source code
 
deleteAll(self)
Deletes all active jobs.
source code
 
restartAll(self)
Restarts all active jobs.
source code
 
printJobs(self)
Prints information about all active Xgrid jobs.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __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 

Create a JobManager for a given Grid and Connection.

This class is mainly designed to be a base class of the Conroller and Grid classes, both of which need to manage Xgrid jobs. The class provides basic capabilities to list active jobs and perform various actions on those jobs (stop, restart, resume, suspend, delete). Job submission is handled by the Controller, Grid and Job classes.

Usage

Parameters:
  • gridID (unicode, str or int) - The grid identifier of the grid on which the JobManager will manage jobs. Internally, the grid identifier is a unicode string, but gridID can be given in any of the formats u'0', '0' or 0. If gridID=u'0', the JobManager will manage jobs on the default grid
  • 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__

jobs(self, update=1)

source code 

Returns a list of initialized Job objects for all active jobs.

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.
Returns: list
a lists of active Job objects.

job(self, jobID=u'999999999', update=1)

source code 

Returns the Job object with job identifier id.

Parameters:
  • jobID (unicode, str, or int) - The job identifier. Can be given as unicode, str or int.
  • 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.
Returns:
Initialize Job object.

jobIDs(self, update=1)

source code 

Returns a tuple of job identifiers for all active jobs.

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.
Returns: tuple
Tuple of job identifiers.

perform(self, action, jobIDs)

source code 

Performs an action on a subset of active jobs.

Parameters:
  • action (str) - The action to be performed as a string. Implemented actions are stop, resume, delete, restart, and suspend.
  • jobIDs (Either the string 'all' or a Python sequence of job identifiers.) - Jobs to perform the action on.