This section contains the following information:
Facts can be retrieved, compared against, and written to (if not read-only) from within jobs. Every grid object has a set of accessor and setter JDL functions. For example, to retrieve the cryptpw job argument fact in the job example listed in Job Arguments and Parameter Lists, you would write the following JDL code:
1 def job_started_event(self): 2 pw = self.getFact("jobargs.cryptpw")
In line 2, the function getFact() retrieves the value of the job argument fact. getFact() is invoked on the job instance Grid object.
The following set of JDL grid object functions retrieve facts:
getFact() factExists() getFactLastModified() getFactNames()
The following set of JDL grid object functions modify fact values (if they are not read-only) and remove facts (if they are not deleteable):
setFact setDateFact setTimeFact setArrayFact setBooleanArrayFact setDateArrayFact setIntegerArrayFact setTimeArrayFact setStringArrayFact deleteFact
For more complete information on these fact values, see GridObjectInfo.
Each Joblet is also a Grid object with its own set of well known facts. These facts are listed in Section B.2, Joblet Class. An instance of the Joblet class runs on the resource. The Joblet instance on the resource has access to the fact set of the resource where it is running. The resource fact set has no meaning outside of this execution context, because the Joblet can be scheduled to run on any of the resources that match the resource and allocation constraints.
For example, using the cracker job example shown in Section 7.7.3, Job Arguments and Parameter Lists, you would write the following JDL code to retrieve the cryptpw job argument fact, the OS family fact for the resource, the Job instanceID fact, and the joblet number:
1 class CrackerJoblet(Joblet): 2 def joblet_started_event(self): 3 pw = self.getFact("jobargs.cryptpw") 4 osfamily = self.getFact("resource.os.family") 5 jobid = self.getFact("jobinstance.id") 6 jobletnum = self.getFact("joblet.number")
In line 3, the function getFact() retrieves the value of the job argument fact. getFact() is invoked on the joblet instance grid object. In line 4, the resource.os.family fact is retrieved for the resource where the Joblet is being executed. This varies, depending on which resource the Joblet is scheduled to run on. In line 5, the IDfact for the job instance is retrieved. This changes for every job instance. In line 6, the joblet index number for this joblet instance is returned. The index is 0 based.
The Policy Debugger page of the PlateSpin Orchestrate Development Client provides a table view of all facts in a running or completed job instance. This view includes the Job instance facts (jobinstance.* namespace) and the facts from the job context.After you select the Policy Debugger tab in the Job Monitor view, the right side panel displays this fact table. For more information, see The Policy Debugger
in the PlateSpin Orchestrate 2.0 Development Client Reference.