GridObjectInfo

The GridObjectInfo class is the base class representation of all grid objects in the system. This provides accessors and setters to a grid object’s fact set.

Methods

Summary:

deleteFact(String factname)

Removes a fact from this grid object.Factname must be fully qualified with the object's namespace.

Parameters: factname - The name of the fact to remove.

Raises: Exception - if fact does not exist or fact is not deleteable.

factExists(String factname)

Determines if the given factname exists in this grid object.

Parameters: factname - Name of fact to check.

Returns: true if fact exists, false if not.

getFact(String factname)

Retrieve the value of the named fact on this grid object. Factname must be fully qualified with the object's namespace.

Examples:

How to retrieve a job argument fact (from quickie example):

      def job_started_event(self):          d = self.getFact("jobinstance.time.submitted")          print "time.ctime(d/1000)=",time.ctime(d/1000)

How to retrieve a date fact and displaying in a readable form:

      def job_started_event(self):          d = self.getFact("jobinstance.time.submitted")          print "time.ctime(d/1000)=",time.ctime(d/1000)

Parameters: factname - Name of fact to retrieve value for.

Returns: Value of fact. Can be None.

Raises: Exception - if fact does not exist

getFactLastModified(String factname)

Retrieves the last modified timestamp for a fact. Factname must be fully qualified with the object's namespace.

Parameters: factname - job instance fact name.

Returns: last modified timestamp in milliseconds from epoch,.

Example:

How to retrieve a job argument fact (from the quickie job example):

      def job_started_event(self):
          last_modified_secs = self.getFact("job.timeout") / 1000
          import time
          print time.ctime(last_modified_secs)

See quickie.job.

getFactNames()

Retrieves a list of all fact names for this grid object.

Parameters: Returns list of all fact names..

refresh()

Refreshes the fact set for this grid object. It only applies for grid objects retrieved remotely such as when running on the resource.

setArrayFact(String factname, PyList list)

Set an Array typed fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object’s namespace.

Parameters: factname - Factname to set. list - Fact value to set. Must be a Python list where all elements are the same type.

setBooleanArrayFact(String factname, org.python.core.PyList list)

Sets a Boolean Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object’s namespace. Note: this is the only way to set empty boolean array facts.

Parameters: factname - Factname to set. list - Fact value to set. Must be a Python list where all elements are the same type

setDateArrayFact(String factname, PyList list)

Sest an Date Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace..

Parameters: factname - Factname to set. list - Fact value to set. Must be a Python list where all elements are the same type.

setDateFact(String factname, PyObject value)

Set the value of a fact of type Date. Creates a new fact if fact does not exist. Factname must be fully qualified with the object's namespace. Date fact values are integers indicating milliseconds since the epoch.

Parameters: factname - Factname to set. value - Integer or long value in milliseconds since the epoch.

Example:

Example to set a jobinstance date fact to indicate the current date and time:

      def job_started_event(self):
          import time
          now_in_millis = long(time.time()) * 1000
          self.setDateFact("myDateFact",now_in_millis)
setFact(String factname, PyObject value)

Sets the value of a fact. Creates a new fact if fact does not exist. Factname must be fully qualified with the object's namespace.

Parameters: factname - Name of fact to set. value - Value of fact to set.

setIntegerArrayFact(String factname, org.python.core.PyList list)

Sets an Integer Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace.

NOTE:This is the only way to set empty integer array facts.

Parameters: factname - Name of fact to set. list - Fact value to set. Must be a Python list where all elements are the same type.

setRealArrayFact(String factname, PyList list)

Sets a Real Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace. Note: this is the only way to set empty real array facts.

Parameters: factname - Name of fact to set. list - Fact value to set. Must be a Python list where all elements are the same type.

setStringArrayFact(String factname, PyList list)

Set a String Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace.

NOTE:This is the only way to set empty string array facts.

Parameters: factname - Name of fact to set. list - Fact value to set. Must be a Python list where all elements are the same type.

setTimeArrayFact(String factname, PyList list)

Sets a Time Array fact on this grid object. Creates a new fact if fact does not exist. The type of all list elements must match. Factname must be fully qualified with the object's namespace.

Parameters: factname - Name of fact to set. list - Fact value to set. Must be a Python list where all elements are the same type.

setTimeFact(String factname, PyObject value)

Sets the value of a fact of type Time. Creates a new fact if fact does not exist. Factname must be fully qualified with the object's namespace. Time fact values are integers indicating milliseconds elapsed.

Parameters: factname - Name of fact to set. value - Time value of fact to set. Must be integer or long to indicate number of milliseconds elapsed.

Example: To set a jobinstance date fact to indicate the current date and time:

      def job_started_event(self):
          self.setTimeFact("myTimeFact",5*60000)

See Also

Javadoc: GridObjectInfo