Novell PLATESPIN ORCHESTRATE 2.0.2 - DEVELOPMENT CLIENT REFERENCE 08-28-2009 Reference page 138

Development client reference
Table of Contents

Advertisement

To create a new computed fact, you subclass the
An implementation uses the
information, see the job structure from the following examples in the
Developer Guide and
"ComputedFact"
"ComputedFactContext"
After the new computed fact is created, you deploy it using the same procedures required for jobs
(using either the zosadmin command line tool or the PlateSpin Orchestrate Development Client).
The following example shows a computed fact that returns the number of active job instances for a
specific job for the current job instance.This fact can be used in an accept or start constraint to limit
how many jobs a user can run in the system.The constraint is added to the job policy in which to
have the limit.In this example, the start constraint uses this fact to limit the number of active jobs for
a user to one:
"""
<constraint type="start" >
<lt fact="cfact.activejobs"
</constraint>
Change JOB_TO_CHECK to define which job is to be limited.
"""
JOB_TO_CHECK="quickie"
class activejobs(ComputedFact):
def compute(self):
138 PlateSpin Orchestrate 2.0 Development Client Reference
ComputedFactContext
Reference:
value="1"
reason="You are only allowed to have 1 job running at a time" />
j = self.getContext()
if j == None:
# This means computed Fact is executed in a non running
# job context.
print "no job instance"
return 0
else:
# Computed fact is executing in a job context
user = j.getFact("user.id")
activejobs = self.getMatrix().getActiveJobs()
count = 0
for j in activejobs:
jobname = j.getFact("job.id")
# Don't include queued in count !
state = j.getFact("jobinstance.state.string")
if jobname == JOB_TO_CHECK \
count+=1
jobid = j.getFact("jobinstance.id")
print "jobid=%s count=%d" % (jobid,count)
return count
ComputedFact
to get the evaluation context. For more
e.g., the ZOC fact browser
and j.getFact("user.id") == user \
and (state == "Running" or state == "Starting"):
class with the
extension.
.cfact
PlateSpin Orchestrate 2.0

Advertisement

Table of Contents
loading

This manual is also suitable for:

Platespin orchestrate 2.0.2

Table of Contents