Command Line Input and Output

The envitaskengine executable handles input and output using stdin and stdout. Any errors that were generated are sent to stderr. The envitaskengine executable also returns an exit code that you can check.

For working examples of command line input and output, see ENVITaskEngine Examples.

Input

Specify input as a JSON string that contains a taskName key with the desired ENVITask name and an inputParameters key with the task parameters. If the ENVITask does not require any parameters, then you can omit the inputParameters key. See Supported Data Types for additional details.

Key:

taskName

Value:

The base name of an ENVITask or an explicit path to a task file (.task). Use the QueryTaskCatalog task to get a list of available tasks. See an example.

 

Key:

inputParameters

Value:

Task input parameters and their values. Each element of the JSON input is a key/value pair with a parameter name and value. Use the QueryTask task to get a list of parameters for a given task. See an example.

Example of Input

{

   "taskName": "ISODATAClassification",

   "inputParameters": {

      "input_raster": {

         "url": "/home/idl/qb_boulder_msi",

         "factory": "URLRaster"

         },

         "number_of_classes": 5,

         "change_threshold_percent": 2,

         "iterations": 10

   }

}

Output

Output is sent to stdout in JSON format. If the task generates output, it will be in an outputParameters key.

Key:

outputParameters

Value:

Task output parameters and their values. Each element of the JSON output is a key/value pair with a parameter name and value.

Example of Output

{

"outputParameters": {

   "output_raster_uri": {

      "url": "output.dat",

      "factory": "URLRaster"

      }

   }

}

Errors

Errors and warnings are sent to stderr. For example, issuing the following command:

echo {"taskName":"doesnotexist"} | envitaskengine

results in the following output via stderr:

ENVITASK: No task matches: doesnotexist

Exit Status

The envitaskengine executable returns the following values indicating its exit status:

Scripts that call the envitaskengine executable should check the exit status after running the executable. Bash scripts can do this using the $? environment variable. Windows batch scripts can do this using the %ERRORLEVEL% environment variable.