|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
11.10 Job Templates
11.10.1 Job Template OverviewJob templates are used for two primary purposes: (1) to provide a means of generically matching and categorizing jobs, and (2) to provide a means of setting arbitrary default or forced attributes for certain jobs. Job templates can be used in many aspects of scheduling but they are most commonly applied in the areas of Dynamic Jobs and Peer Based Grid usage policies. Job templates are defined using the JOBCFG configuration parameter. 11.10.2 Applying Job Templates11.10.2.1 MatchingThe JOBMATCHCFG parameter allows relationships to be established between a number of job templates. JMAX and JMIN function as filters to determine whether a job is eligible for a subsequent template to be applied to the job. If a job is eligible, JDEF and JSET templates apply attributes to the job. The table in section 11.10.3 Job Template Extension Attributes indicates which job template types are compatible with which job template extension attributes. The following types of templates can be specified with the JOBMATCHCFG parameter:
# limit all users to a total of two non-interactive jobs USERCFG[DEFAULT] MAXJOB=2 # reservation configuration SRCFG[test] DESCRIPTION="compute pool for interactive and short duration jobs" SRCFG[test] JOBATTRLIST=INTERACTIVE SRCFG[test] MAXTIME=1:00:00 SRCFG[test] HOSTLIST=R:atl[16-63] # job template configuration JOBCFG[inter.min] FLAGS=interactive JOBCFG[inter.set] FLAGS=ignpolicies REQRSV=test JOBMATCHCFG[interactive] JMIN=inter.min JSET=inter.set In the preceding example, a reservation called test is created. This reservation is only accessible by interactive jobs and jobs that will take less than one hour to complete. Specifying MAXJOB=2 means that each user on the system is only allowed to run two jobs simultaneously. The job template configuration is signified by the JOBCFG parameter. The inter.min template (JMIN) determines that if a job is marked as interactive it is eligible to have inter.set template applied to it. The JOBMATCHCFG parameter establishes the relationship between inter.min and inter.set. The inter.set template forces the ignpolicies flag on the job, which allows the job to ignore the MAXJOB policy. Also, the job automatically requests the reservation named test. Any user submitting a job may have as many interactive jobs running as resources permit, and the job runs inside the test reservation, which constrains the jobs to run on nodes at1[16-63]. With this template, users do not need to know to which nodes to send interactive jobs; Moab automatically sends interactive jobs to the nodes specified in the reservation. 11.10.2.2 SelectingRather than matching a job automatically based on job attributes, a specific template can be directly requested by setting the SELECT attribute to TRUE. Attributes specified in the job template are applied to the job. JOBCFG[inter.set] FLAGS=ignpolicies REQRSV=test SELECT=true In the preceding example, instead of the interactive jobs automatically going to the reservation named test (as in the Matching example), users can request the inter.set template for the ignpolicies flag and the requested reservation test to be applied to the job. Use the following to request the job template: msub -l template=inter.set myjob.shSelecting a specific reservation is often used in creating workflows. See 11.10.7 Creating Workflows with Job Templates for more information. 11.10.3 Job Template Extension AttributesWhen creating a job template, any attribute acceptable within the WIKI workload query data format can be used. In addition, job templates can use any of the extension attributes in the following table. Note that a checkmark in the Template Type (JMIN, JMAX, JDEF, JSET) row indicates compatibility with the associated attribute.
11.10.4 Resource Manager TemplatesJob templates can also be applied to resource managers modifying attributes of jobs submitted to, migrated to, or routed through specified resource manager interfaces. In particular the RMCFG attributes MAX.JOB, MIN.JOB, SET.JOB, and DEFAULT.JOB can be used. However, the meanings of resource manager job templates are slightly different than their JOBMATCHCFG counterparts as described in the following table. 11.10.5 Job Template ExamplesJob templates can be used for a wide range of purposes including enabling automated learning, setting up custom application environments, imposing special account constraints, and applying group default settings. The following examples highlight some of these uses: 11.10.5.1 Example 1: Setting Up Application-Specific EnvironmentsJOBCFG[xxx] EXEC=*app* JOBPROLOG=/usr/local/appprolog.x 11.10.5.2 Example 2: Applying Job Preferences and DefaultsJOBCFG[xxx] CLASS=appq EXEC=*app* PREF=clearspeed NODEALLOCATIONPOLICY PRIORITY NODECFG[DEFAULT] PRIOF=5.0*PREF 11.10.5.3 Example 3: Applying Resource Constraints to Fuzzy CollectionsIn the following example, a job template match is set up. Using the JOBMATCHCFG parameter, Moab is configured to apply all attributes of the inter.set job template to all jobs that match the constraints of the inter.min job template. In this example, all interactive jobs are assigned the ignpolicies flag that allows them to ignore active, idle, system, and partition level policies. Interactive jobs are also locked into the test standing reservation and thus only allowed to run on the associated nodes. # limit all users to a total of two non-interactive jobs USERCFG[DEFAULT] MAXJOB=2 SRCFG[test] DESCRIPTION="compute pool for interactive and short duration jobs" SRCFG[test] JOBATTRLIST=INTERACTIVE SRCFG[test] MAXTIME=1:00:00 SRCFG[test] HOSTLIST=R:atl[16-63] JOBCFG[inter.min] FLAGS=interactive JOBCFG[inter.set] FLAGS=ignpolicies REQRSV=interactive JOBMATCHCFG[interactive] JMIN=inter.min JSET=inter.set 11.10.5.4 Example 4: Resource Manager TemplatesIn the following example, interactive jobs are not allowed to enter through this resource manager and any job that does route in from this resource manager interface has the preemptee flag set. JOBCFG[no_inter] FLAGS=interactive JOBCFG[preempt_job] FLAGS=preemptee RMCFG[gridA.in] MAX.JOB=no_inter SET.JOB=preempt_job 11.10.6 Managing Job Templates11.10.6.1 Dynamically Creating Job TemplatesJob templates can be dynamically created while Moab is running using the mschedctl -m command.
> mschedctl -m --flags=pers "JOBCFG[preempt] FLAGS=PREEMPTOR" > mschedctl -m --flags=pers "JOBCFG[preempt] SELECT=TRUE" > msub -l template=preempt mysjob.sh 11.10.6.2 Removing Job TemplatesJob templates cannot be dynamically removed. You can only remove job templates by commenting out (or removing) the template definition (lines) in the moab.cfg file; then you must restart Moab.11.10.6.3 Dynamically Modifying Job TemplatesJob templates can be dynamically modified by using the mschedctl -m command.
> mschedctl -m "JOBCFG[single] NODEACCESSPOLICY=SINGLEJOB" 11.10.6.4 Viewing Job TemplatesJob templates can be viewed by specifying "template:" before the template name in checkjob and also by using the command mdiag -j as in the following example: > mdiag -j --flags=policy > checkjob -v template:match.min
Moab can create workflows from individual jobs using job templates. The Moab naming convention for jobs created with job templates is <moabid>.<templatename>. By default, when Moab submits jobs to only one resource manager, the job IDs are synchronized with the resource manger's job IDs. For consistency, the parameter USEMOABJOBID may be used so that a template-created job is easily associated with its parent job (such as moab.1, moab.1.setup.pre).
11.10.7.1 Example 1: Building a Workflow with Job TemplatesIn this example, creating a job in the engineering account generates a workflow based on a two-step setup. The job is set to depend on the completion of this workflow. JOBMATCHCFG[engineering.job] JMIN=engineering.match JSET=engineering JOBCFG[engineering.match] ACCOUNT=engineering JOBCFG[engineering] TEMPLATEDEPEND=AFTER:setup.pre2 JOBCFG[setup.pre2] TEMPLATEDEPEND=AFTER:setup.pre SELECT=TRUE EXEC=/nfs/tools/setup.pre2.sh JOBCFG[setup.pre] TASKS=2 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/setup.pre.sh STAGEIN=TRUE In the previous example, a job is submitted with the account name engineering. Moab then matches the submitted job with the engineering template. The engineering template states that the job must run after the setup.pre2 template job runs. Then the setup.pre2 template creates a job from the specified EXEC string; the setup.pre2 job must run after the setup.pre template job runs. The setup.pre template creates a job from the specified EXEC string. The new setup.pre job is specified for two processors and has a wallclock time of one minute. Note that since the setup.pre.sh script is not on an NFS mount, it must be staged in. STAGEIN has a value of TRUE or FALSE. If set to TRUE, Moab ensures the executable is staged out to the compute host where the dependent job runs. If set to FALSE, Moab assumes the executable is already available on the compute host. 11.10.7.2 Example 2: A Workflow with Multiple DependenciesIn this example the job will depend on the completion of two other jobs Moab creates. Both jobs execute at the same time. # Engineering2 JOBCFG[engineering2] TEMPLATEDEPEND=AFTER:engineering2.pre2 TEMPLATEDEPEND=AFTER:engineering2.pre JOBCFG[engineering2.pre2] TASKS=2 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/engineering2.pre2.sh JOBCFG[engineering2.pre] TASKS=2 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/engineering2.pre.sh JOBCFG[engineering2.match] ACCOUNT=engineering2 JOBMATCHCFG[engineering2.job] JMIN=engineering2.match JSET=engineering2 11.10.7.3 Example 3: Jobs that Run After the Submission JobThree additional jobs are created that depend on the submitted job. # Workflow 2 JOBCFG[workflow2] TEMPLATEDEPEND=BEFORE:workflow2.post1 TEMPLATEDEPEND=BEFORE:workflow2.post2 TEMPLATEDEPEND=BEFORE:workflow2.post3 JOBCFG[workflow2.post1] TASKS=2 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow2.post1.sh JOBCFG[workflow2.post2] TASKS=2 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow2.post2.sh JOBCFG[workflow2.post3] TASKS=2 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow2.post3.sh JOBCFG[workflow2.match] ACCOUNT=workflow2 JOBMATCHCFG[workflow2.job] JMIN=workflow2.match JSET=workflow2 11.10.7.4 Example 4: A Complex WorkflowA complex workflow that handles failures. # Workflow 4 JOBCFG[workflow4.step1] TASKS=1 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow.step1.sh TEMPLATEDEPEND=BEFOREFAIL:workflow4.fail1 JOBCFG[workflow4.fail1] TASKS=1 WCLIMIT=00:00:30 SELECT=TRUE EXEC=/usr/tools/workflow.fail.1.sh TEMPLATEDEPEND=BEFOREANY:workflow4.fail2 JOBCFG[workflow4.fail2] TASKS=1 WCLIMIT=00:00:30 SELECT=TRUE EXEC=/usr/tools/workflow.fail.2.sh # Submission job JOBCFG[workflow4.step2] TEMPLATEDEPEND=AFTEROK:workflow4.step1 TEMPLATEDEPEND=BEFOREOK:workflow4.step3.1 TEMPLATEDEPEND=BEFOREOK:workflow4.step3.2 JOBCFG[workflow4.step3.1] TASKS=1 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow.step3.1.sh JOBCFG[workflow4.step3.2] TASKS=1 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow.step3.2.sh TEMPLATEDEPEND=BEFOREOK:workflow4.step4 JOBCFG[workflow4.step4] TASKS=1 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow.step4.sh JOBCFG[workflow4.step4] TEMPLATEDEPEND=BEFOREOK:workflow4.step5.1 TEMPLATEDEPEND=BEFOREOK:workflow4.step5.2 TEMPLATEDEPEND=BEFORENOTOK:workflow4.step5.3 JOBCFG[workflow4.step5.1] TASKS=1 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow.step5.1.sh JOBCFG[workflow4.step5.2] TASKS=1 WCLIMIT=00:01:00 SELECT=TRUE EXEC=/usr/tools/workflow.step5.2.sh JOBCFG[workflow4.step5.3] TASKS=1 WCLIMIT=00:00:30 SELECT=TRUE EXEC=/usr/tools/workflow.step5.3.sh JOBCFG[workflow4.match] ACCOUNT=workflow4 JOBMATCHCFG[workflow4.job] JMIN=workflow4.match JSET=workflow4.step2 See Also
Searches Moab documentation only
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| © 2001-2010 Adaptive Computing Enterprises, Inc. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||