The IDL Workbench > ESE Tasks

# ESE Tasks

The IDL Workbench contains functionality to help you write and publish Tasks for use in ENVI Services Engine (ESE). This includes the ability to easily create JSON and PRO code, edit and validate JSON files, and publish Tasks from IDL directly to an ESE Server.

- Create a Task
- Edit a Task
- Publish a Task
- Manage and Organize Tasks

## Create a Task

1. In the Workbench's Project Explorer, create or select a project to hold the new ESE Task.
2. Select FILE > New Task.
3. The New Task Dialog appears. Specify:
   - Display Name - the name of the task as it will appear in the Project Explorer.
   - Folder Name - specify the name of a folder that will contain the task
   - Folder Location - select a new folder location, or keep the default (the project location that you selected above).
   - IDL Routine Name - specify a name for the IDL routine (`.pro` file) that will be part of this task.
4. Click the Finish button.

IDL creates the Task folder as well as the templates for the Task's `config.json` and `.pro` files. You can navigate to and open these files via the Project Explorer, just as you would any other IDL code.

Note: When developing ESE Tasks using !SERVER in the IDL Workbench, make sure to add `\lib\!server__define.pro` and `\lib\verifyserver.pro` to IDL's !PATH system variable.

## Edit a Task

The `config.json` editor window, showing the "Publish" tab at the bottom:

- Navigate to and open the `config.json` and `*.pro` files for your Task using the Project Explorer.
- If you want IDL to validate your JSON, click Project > Properties > JSON Properties from the Workbench menu and make sure "Enable JSON validation in project" is selected. IDL validates your `config.json` file when you save it. If part of your `config.json` does not pass validation, IDL will mark the line that is not valid by adding a red and white "x" icon in the left gutter of the JSON editor.

Note: IDL allows you to save your `config.json` even if it is not valid, but it will not allow you to upload it to an ESE server until it passes validation.

- Edit your Task files as you would any other IDL code files.
- If you have additional files that need to be incorporated into your Task, place these files in the Task's folder.

For more information on creating tasks, consult your ENVI Services Engine online documentation.

## Publish a Task

Once you complete writing your Task's `.pro` and `config.json` files, you can upload the Task directly to an ESE server from within the IDL Workbench using the Publish tab:

1. Open the Task's `config.json` file and save it.
2. If your JSON is valid, the Publish tab appears at the bottom of the `config.json` editor.
3. Click the Publish tab to begin uploading the Task to ESE.
4. If this is your first upload to a particular ESE server, you may need to add its host name to the left ("ESE Server") selection box:
   - Click the Add button to add a server and top level folder name. The Workbench displays a dialog box for the server URL.
   - Enter the Server URL for the top level of the catalog. Generally this is `http://<hostname>:<port>/ESE`. The default port is 8181 and the default Catalog name is "ESE", so typically `http://<hostname>:8181/ESE` will be the location you will specify here. You can get this information directly from your ESE Admin Console or from your System Administrator.
   - If the URL is valid, the Workbench displays it in the ESE Server list.
5. Select the server in the list and IDL will display its Service Endpoints on the right.
6. Select the service endpoint where you want to upload your Task, then click the Publish button. IDL displays a dialog allowing you to verify the details of the upload. If everything is OK, click the Publish button on the dialog.
7. IDL will then display a message that it successfully uploaded your task to the server.

Note: If you set your Project > Properties > JSON Properties to validate `config.json`, the file must be valid before IDL will allow you to publish your task. If it is not valid, the Publish tab is not visible at the bottom of the Workbench's JSON editor.

Note: The Workbench will not allow you to upload a synchronous task to an asynchronous service, and vice versa. If you try to upload across services, the Publish button will be inactive.

## Manage and Organize Tasks

The Publish tab that you access from the `config.json` file gives you ways to manage and organize your Services, folders, and tasks.

On the Service Endpoint part (right side) of the Publish Task tab, you can do the following:

Icon | Name | Description
--- | --- | ---
| Publish | Select the ESE directory or a folder and then click the Publish button to publish the task `.pro` code and the `config.json` to the selected ESE server.
| New Folder | Select the ESE directory or a folder and then click the Folder button to add a folder.
| New Service | Select the ESE directory or a subfolder and then click the New Service button to add a new service. You must type a name and select the type of service (Asynchronous or Synchronous). You can also add an optional description.
| Edit Properties | Select an item in the Service Endpoint directory structure and click the Edit Properties button to change the name or description.
| Delete | Select an item in the Service Endpoint directory structure and click the Delete button to remove the item.