The ENVIAsyncSpawnTaskJob class is a subclass of the IDLAsyncSpawnTaskJob class for ENVI purposes. It allows the user to specify a single ENVITask that will executed by the ENVITaskEngine when there are available resources. The ENVITask must have all of its input parameters specified before creating this job, as it will be cloned and dehydrated for passage to ENVITaskEngine via STDIN. Any subsequent changes to the task's parameter values will not be reflected when this job executes the task in the ENVITaskEngine.


e = envi()
; Open a raster
File = Filepath('qb_boulder_msi', Subdir=['data'], $
raster = enviUrlRaster(File)
numClasses = [ 3, 5, 7 ]
numJobs = N_Elements(numClasses)
; Construct an IDLAsyncJoin object to use for waiting on all jobs to complete
oJoin = IDLAsyncJoin()
; Construct IDLAsyncQueue to manage parallel execution of jobs
oQueue = IDLAsyncQueue(CONCURRENCY=numJobs)
; Create an object array to hold all jobs
oJobs = ObjArr(numJobs)
; Create a task to be used by the jobs
oTask = ENVITask('ISODATAClassification')
oTask.Input_Raster = raster
FOR i=0, numJobs-1 DO BEGIN
  ; Update task parameters to the current number of classes
  oTask.Number_of_Classes = numClasses[i]
  ; Construct ENVIAsyncSpawnTaskJob that clones the task, 
  ; passing in the join object.
  oJobs[i] = ENVIAsyncSpawnTaskJob(oTask, JOIN=oJoin)
; Submit all jobs to the queue for execution
oQueue.SubmitJob, oJobs
; Wait for all jobs to be done
; Create 4 views
v0 = e.GetView()
v1 = e.CreateView()
v2 = e.CreateView()
v3 = e.CreateView()
; Visualize each job output raster in a different view
l0 = v0.CreateLayer(raster)
l1 = v1.CreateLayer(oJobs[0].Task.Output_Raster)
l2 = v2.CreateLayer(oJobs[1].Task.Output_Raster)
l3 = v3.CreateLayer(oJobs[2].Task.Output_Raster)


Result = ENVIAsyncSpawnTaskJob(Task [, /COMPILE] [, JOIN=IDLAsyncJoin] [, WAIT=Float])



A scalar ENVITask object owned by this job, which will be executed inside ENVITaskEngine when Start is called.


COMPILE (optional)

Specify an optional Boolean flag that indicates whether the "--compile" flag should be added to the ENVITaskEngine invocation. Use this if your task uses PRO code instead of save files.

JOIN (optional)

Specify an IDLAsyncJoin object that is passed to the IDLAsyncJob base class Init() method for handling.

WAIT (optional)

Specify a value in seconds to pass to IDLAsyncSpawnJob::Init for handling.


ENVIAsyncSpawnTaskJob inherits all methods from IDLAsyncSpawnTaskJob. ENVIAsyncSpawnTaskJob also has the following method:



ENVIAsyncSpawnTaskJob inherits all properties from IDLAsyncSpawnTaskJob.

Version History



API Version


See Also

ENVIAsyncSpawnTaskJob::OnDone, ENVITask