The ESETask class represents ESE tasks. Each time a task is run, a new job is produced. Tasks represent algorithms and jobs represent the execution of an algorithm, with particular inputs, outputs and state. However, ESETask objects do provide the ability to specify input parameter values prior to being run.

Methods


Examples


Example 1

This example demonstrates the simplest form of how to connect to an ESE server, get a task and run it. See Custom IDL Tasks on how to create the addition task. Copy the custom task to your IDL installation lib directory for it to be available on the server.

Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Job = Task.Run(a=1, b=2)

Example 2

By default, both asynchronous and synchronous tasks are run synchronously. However, asynchronous tasks can be freed to run asynchronously via the ASYNCHRONOUS keyword to run:

Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Job = Task.run(a=1, b=2,/ASYNCHRONOUS)

Example 3

In this example, the task is run with the same values as in the first example, but the values are set on the task object, instead of in the "run" method.

Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Task.a = 1
Task.b = 2
Job = Task.Run()

Example 4

This example sets one parameter on the task and then supplies values for the second parameter when the task is run. For all invocations, parameter 'a' will have a value of 1.

Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Task.a = 1
 
FOR i = 0, 9 DO BEGIN
 
  Job = Task.Run(b=i)
 
PRINT, 'Computation: ' + $
  strtrim(Job.a, 2) + ' + ' + $
  strtrim(Job.b, 2) + ' = ' + $
  strtrim(Job.c, 2)
 
ENDFOR

Properties


PARAMETERNAME (IDLVariable, Set, Get)

The name of any of the task's parameters. The ESE API will dynamically set and get the values of task parameters. These values will be used in the Run() method unless they are overridden by a corresponding keyword in the Run() method. The parameter name must be fully specified, without abbreviation.

ESETask::GetParameter


Returns an ESETaskParameter object for the named parameter. If the parameter does not exist, then it returns !null.

Example


Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Parameter = Task.GetParameter('a')

Syntax


Result = Obj.[ESETask::]GetParameter( Name )

Return Value


Returns an ESETaskParameter object for the named parameter. If the parameter does not exist, then it returns !null.

Arguments


Name

Specifies the name to match.

Keywords


None.

ESETask::GetParameters


Returns a list of ESETaskParameter objects.

Example


Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Parameters = Task.GetParameters()

Syntax


Result = Obj.[ESETask::]GetParameters( [ /NAMES ])

Return Value


Returns a list of ESETaskParameter objects. If the task does not have any parameters then returns an empty list. If NAMES is set, it returns an array of parameter names, or returns !null if the task does not have any parameters.

Arguments


None.

Keywords


NAMES

Set this keyword to have the method return just the names of the parameters, instead of ESETaskParameter objects.

ESETask::GetParent


This function returns the ESEService object in which this task resides.

Example


Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Service = Task.GetParent()

Syntax


Result = Obj.[ESETask::]GetParent()

Return Value


The return value is the ESEService object that this the parent to the task.

Arguments


None.

Keywords


None.

ESETask::Info


Returns a dictionary with all the properties of the task.

Example


Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Info = Task.Info()
Desc = info.description

Syntax


Result = Obj.[ESETask::]Info()

Return Value


The return value is a dictionary with the following fields:

  • name: (string) The task's name, which is the name of the PRO-code entry point routine.
  • displayName: (string) The task's display name.
  • description: (string) The description of the task.
  • executionType: (string) The execution type as defined by the constants ESE.synchronous and ESE.asynchronous.
  • uri: (string) The URI to the task.

Arguments


None.

Keywords


None.

ESETask::Run


Runs the task and produces an ESEJob object, which can be used to monitor status and get the values of output parameters.

The job is run synchronously unless the task is asynchronous and the ASYNCHRONOUS or ASYNC keywords are set. Synchronous tasks are always run synchronously, regardless of the use of the ASYNCHRONOUS and ASYNC keywords.

Input parameter values are specified via keywords. Output parameter names and invalid parameter names throw an error (or cause run to return an ESEJob with error information). The conversion from IDL to JSON is performed by default, or by custom serialization and deserialization methods.

Example


In this example, the 'addition' task is run. The input parameter 'a' is set on the task object and input parameter 'b' is set when the task is run.

Task = ESE.GetTask('http://localhost:9191/ese/services/IDL/addition')
Task.a = 1
Job = Task.Run(b=2)
PRINT, Job.c

The value for the output parameter 'c' can only be retrieved from the ESEJob object.

Syntax


Job = Obj.[ESETask::]Run Keywords [, /ASYNC | /ASYNCHRONOUS ])

Return Value


This method returns an ESEJob object, which represents the execution of the task. The job contains all the input and output parameter values as well as the execution state (ESE.jobExecuting, ESE.jobSucceeded, ESE.jobFailed, etc.).

Arguments


None.

Keywords


ASYNC

The only allowable abbreviation of the ASYNCHRONOUS keyword.

ASYNCHRONOUS

Set this keyword to run jobs asynchronously. Only asynchronous jobs can be run asynchronously. This keyword is ignored with synchronous tasks.

INPUTPARAMETER

Set input parameters to values using normal IDL keyword-value pairs. For example, if a task has a parameter 'mode' then to run it with a value of 2. it as: Task.run( mode = 2 ).

Version History


IDL 8.4.1 Introduced
IDL 8.5.2 Deprecated the return of version, reset, invocationType fields on return value from ESETask::Info

See Also


ESE, ESEJob, ESEService, ESETaskParameter