The following procedure details the steps required to create a workflow that builds a VM. This workflow contains four job templates:
createVM
- The system job that creates the VM. It starts the workflow but may not run immediately. The trigger sets the IP address of the VM as a variable when it successfully completes.installSoftware
- The system job that installs software on the new VM. It depends on the successful completion of createVM
and uses the IP address variable to locate the correct VM.createVMWithSoftware
- The VM tracking job the user submits to request the workflow. It is the final job in the workflow and depends on the successful completion of installSoftware
.destroy
- The job that, if createVMWithSoftware
is canceled, runs a script to delete the VM.
To create a generic system job workflow
createVM
).JOBCFG[createVM] GENERICSYSJOB=TRUE
JOBCFG[createVM] INHERITRES=TRUE
JOBCFG[createVM] TRIGGER=EType=start,AType=exec,Action="$HOME/installVM.py $HOSTLIST",Timeout=1:00:00,sets=^IPAddr
installSoftware
).createVM
job using the TEMPLATEDEPEND attribute (see the Job Dependency Syntax table for options). In this example, the installSoftware
job begins after the createVM
job completes successfully.IPAddr
variable.JOBCFG[installSoftware] GENERICSYSJOB=TRUE
JOBCFG[installSoftware] INHERITRES=TRUE
JOBCFG[installSoftware] TEMPLATEDEPEND=AFTEROK:createVM
JOBCFG[installSoftware] TRIGGER=EType=start,AType=exec,Action="$HOME/setupSoftware.py $IPAddr",Timeout=30:00,Flags=objectxmlstdin
![]() | If you are using your workflow in Moab Web Services or Moab Viewpoint, the trigger attached to the last setup job must pass up the |
createVMWithSoftware
).createVMWithSoftware
should begin after installSoftware
completes successfully.vmtracking
.destroy
job in the workflow. When this job is canceled, the destroy
job runs a script to delete the service.JOBCFG[createVMWithSoftware] TEMPLATEDEPEND=AFTEROK:installSoftware SELECT=TRUE FLAGS=NORMSTART,VMTRACKING
JOBCFG[createVMWIthSoftware] DESTROYTEMPLATE=destroy
destroy
job template, specifying that it is a generic system job. Attach a trigger with a script that will take the location of the VM or other workflow service from the IPAddr
variable and destroy the workflow.
JOBCFG[destroy] GENERICSYSJOB=TRUE
JOBCFG[destroy] TRIGGER=EType=start,AType=exec,Action="$HOME/destroy.py $IPAddr",timeout=5:00
![]() |
If you wish to implement an automatic VM migration policy, you must similarly configure a migration job and link to it via the MIGRATETEMPLATE attribute. |
createVMWithSoftware
job template and any other desired resources.
You must specify a script to satisfy the msub syntax, but it will not actually run. > msub -l walltime=2:00:00,template=createVMWithSoftware,nodes=1:ppn=4,mem=1024 anyScript.py
![]() | If ENABLEVMDESTROY is FALSE (default), Moab puts the VM-tracking job on hold when a VM build times out rather than deleting it. The job is visible in the showq report. Releasing the job hold causes Moab to attempt to pick up the VM again. |
Moab creates a job and applies the createVMWithSoftware
template to it. This includes the creation of the installSoftware
and createVM
jobs. The INHERITRES attribute causes the new jobs to adopt the same resource request as createVMWithSoftware
(4 processors and 1 GB of memory). Moab then applies their own templates.
The createVM
job runs first, the trigger script returning the IP address of the new VM and setting it as a variable. The job passes its allocation to the installSoftware
job. installSoftware
uses the IP address variable to locate the VM and install software on it. The job returns its resources to createVMWithSoftware
, which is now the VM-tracking job.
Copyright © 2012 Adaptive Computing Enterprises, Inc.®