3.7 Using Other Grid Objects

Grid objects can be created and retrieved using jobs. This is done when facts from other objects are needed for job decision processing or when joblets are executed on a resource.

The MatrixInfo Grid object represents the system and from the MatrixInfo object, you can retrieve other grid objects in the system. For example, to retrieve the resource grid object named webserver and a fact named resource.id from this object, you would enter the following JDL code:

    webserver = getMatrix().getGridObject(TYPE_RESOURCE,"webserver")
    id = webserver.getFact("resource.id")

In Line 1, the ResourceInfo Grid object for webserver is retrieved. The getMatrix() built-in function retrieves the MatrixInfo object instance. getGridObject() is a method on the MatrixInfo class. In Line 2, the fact value for the resource fact resource.id is retrieved.

The MatrixInfo Grid object also provides functions for creating other Grid objects. For more complete information about these functions, see MatrixInfo.

The MatrixInfo object can be used in both Job and Joblet classes. In the Joblet class, MatrixInfo cannot create new Grid objects. If your job is required to create Grid objects, you must use MatrixInfo in the Job class.