Execute a task
This endpoint is used to execute a task, a program that executes within a few seconds and is safe to interrupt or re-submit. The request contains the program and arguments - variables used by the program or by the service to alter how the program is run. Submitting the request triggers the service to establish a session, submit the program to the session, wait for the program to complete, and return any requested output. The response contains the status of the task and any output requested.
1{2 "id": "4c6775e3-50f3-4c72-80a3-a7e1069876dc",3 "name": "Hello World",4 "description": "This task creates html output which says Hello to the name stored in the MYNAME argument.",5 "state": "completed",6 "jobConditionCode": 0,7 "creationTimeStamp": "2016-05-20T16:16:10Z",8 "elapsedTime": 225,9 "contextId": "ea0d3ee1-894f-4936-bc2b-f611a878a0dd",10 "contextName": "MySampleContext",11 "sessionId": "c1a108bb-6019-4876-807f-eeac467b9c0",12 "jobId": "71fc2eae-272c-45b4-aaf7-76f6cf259400",13 "variables": {14 "GLOBAL_MYNAME": "John"15 }16}
The request body contains the program to execute and any arguments that are needed by the program or by the service to alter how the program is executed. If using multipart/form-data the request can also include input files.
Provides an object that you use to execute a task.
| Name | Type | Required | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
name | string | false | Specifies an optional name that is associated with this task. | ||||||||||||||||||||||||
description | string | false | Specifies an optional description for this task. | ||||||||||||||||||||||||
code | string | true | Specifies the program to be executed. Each line should be separated by a new line character (\n, \r, or \r\n). For example, "data _null_;\ncall sleep(1, 60);\nrun;". | ||||||||||||||||||||||||
arguments | object | true | Specifies a map of string keys and string values used as variables for the program or as instructions on how to execute the program. Variables Usage:
If your program expects a variable, you can provide it here. For
example, if your program expects the variable Altering Program Execution:
Arguments can also be used to alter how the service executes the
task. For instance, what context to create the session on or what
output to return. Make sure that an argument indicating what session
or context the service should use is included. For example, if you
have already created a session and want the task to execute on your
session, you should provide the For a full list of arguments available to alter the program's execution, refer to the table below.
|
| Status | Meaning | Description | ||
|---|---|---|---|---|
| 200 | OK | The task was executed successfully. The response contains the final status of the job as well as its condition code and any errors that were encountered during the execution. | Schema | |
| 400 | Bad Request | The request was invalid. This can occur because the request body does not satisfy the schema for application/vnd.sas.compute.task.request. Ensure all the required properties are present and that the values are valid. | Schema | |
| 404 | Not Found | A resource identified in the request does not exist. For example, the Compute Context or Session identified in the task request does not exist. Refer to the error message for more information. | Schema | |
| 415 | Unsupported Media Type | The server does not support the media type specified in the Content-Type header. If sending a json body, ensure that the Content-Type header is set to application/vnd.sas.compute.task.request+json. If sending multipart/form-data, ensure that the taskRequest part is first and that its Content-Type header is set to application/vnd.sas.compute.task.request+json. | Schema | |
| 504 | Gateway Timeout | The request timed out. This can occur if the task takes longer than the timeout value configured in the context or deployment configuration. If you experience this error, consider if the program should be executed using the Job Execution Service instead of this endpoint. | Schema |