2.1 JDL Job Scripts

The PlateSpin Orchestrate job definition language (JDL) is an extended and embedded implementation of Python. The PlateSpin Orchestrate system provides additional constructs to control and access the following:

For more information about the PlateSpin Orchestrate JDL script editor, see Section 7.2, JDL Package.

The JDL language allows for the scripted construction of logic that can be modified by external parameters and constraints (through one or more associated policies) at the time the job instance is executed. Development of a job with the JDL (Python) language is very straightforward. For a listing of the job, joblet, and utility classes, see Section B.0, PlateSpin Orchestrate Job Classes and JDL Syntax.

A simple “hello world” Python script example that runs a given number of times (numTests) in parallel (subject to resource availability and policy) is shown below:

class exampleJob(Job):
    def job_started_event(self):
        print 'Hello world started: got job_started_event'
        # Launch the joblets
        numJoblets = self.getFact("jobargs.numTests")
        pspace = ParameterSpace()
        i = 1
        while i <= numJoblets:
            pspace.appendRow({'name':'test'+str(i)})
            i += 1
        self.schedule(exampleJoblet, pspace, {})

class exampleJoblet(Joblet):
    def joblet_started_event(self):
        print "Hello from resource%s" % self.getFact("resource.id")

This example script contains two sections:

Because the resources are not requested explicitly, they are allocated based on the resource constraints associated with this job. If none are specified, all resources match. The exampleJoblet class would typically execute some process or test based on unique parameters.

2.1.1 Principles of Job Operation

Whenever a job is run on the PlateSpin Orchestrate system it undergoes state transition, as illustrated in Figure 2-1. In all, there are 11 states. The following four states are important in understanding how constraints are applied on a job’s life cycle through policies:

Accept: Used to prevent work from starting; enforces a hard quota on the jobs.

Start: Used to queue up work requests; limits the quantity of jobs or the load on a resource.

Resource: Used to select specific resources.

Stop: Used to abort jobs; provides special timeout or overrun conditions.

Figure 2-1 Constraint-Based Job State Transition

For more information about job life cycle, see Section 7.3.1, Job State Transition Events.