Jobs

Create a SAS job

Creates a new job to run a SAS program. The type of job is created depending on the Accept header. application/vnd.sas.batch.job.request.sas.batch+json headers creates a Batch job to run a SAS program. application/vnd.sas.batch.job.request.sas.line.mode+json headers creates a new interactive job to run SAS in line mode. application/vnd.sas.batch.job.request.command.batch+json headers creates a Batch job to run an arbitrary command. application/vnd.sas.batch.job.request.command.interactive+json headers creates an interactive job to run an arbitrary command.

post/jobs

Request

  • Base URL: https://example.com/batch
  • URL: https://example.com/batch/jobs
  • Auth: none declared

Request body

fileSetIdstring required

Specifies the ID of the file set to use for transporting files to and from the job.

restartType'job' | 'label' | 'none' | 'step'

Specifies whether the job can be restarted and the type of restart. 'job' indicates that the job is restarted and no checkpoint restart is done. 'label' indicates the job is restarted using SAS Label Checkpoint restart. 'none' indicates the job cannot be restarted. 'step' indicates the job is restarted using SAS Data Step Checkpoint restart.

listFilestring

Specifies the file name and, optionally, the path to use for the output SAS list file. If the specified name is a full path, the user must be able to access the existing directory or be able to create the directory path in the Batch server pod. If the specified path is only a file name and the outputDir option is specified, the SAS list file is placed in the specified output directory. If the specified path is only a file name and the outputDir option is not specified, the SAS list file is placed in the file set. The file name can use the following replaceable parameters in the file name or path: <UL> <LI>@STARTTIME@ - the start time of the Batch job in YYYY-MM-DD-hh-mm-ss format. <LI>@FILESETID@ - the file set ID. <LI>@SASPGMNAME@ - the base name of the SAS program. </UL> Available in version 2 and higher.

logFilestring

Specifies the file name and, optionally, the path to use for the output SAS log file. If the specified name is a full path, the user must be able to access the existing directory or be able to create the directory path in the Batch server pod. If the specified path is only a file name and the outputDir option is specified, the SAS log file is placed in the specified output directory. If the specified path is only a file name and the outputDir option is not specified, the SAS log file is placed in the file set. The file name can use the following replaceable parameters in the file name or path: <UL> <LI>@STARTTIME@ - the start time of the Batch job in YYYY-MM-DD-hh-mm-ss format. <LI>@FILESETID@ - the file set ID. <LI>@SASPGMNAME@ - the base name of the SAS program. </UL> Available in version 2 and higher.

outputDirstring

Specifies a directory in the server that is used to store job output. The default is to upload the files to the file set. The user must be able to either access the existing directory or create the directory path in the Batch server pod. The directory name can use the following replaceable parameters in the name or path: <UL> <LI>@STARTTIME@ - the start time of the Batch job in YYYY-MM-DD-hh-mm-ss format. <LI>@FILESETID@ - the file set ID. <LI>@SASPGMNAME@ - the base name of the SAS program. </UL> Available in version 2 and higher.

sasProgramNamestring required

Specifies the file name of the program to process.

sasOptionsstring

Specifies the SAS options to use on the SAS command line.

watchOutputboolean

Specifies whether the STDOUT of the Batch job is available for retrieval through the REST API.

versioninteger required

Specifies the version number of this representation schema. This is version 2.

Example request

{
  "fileSetId": "JOB_20220606_182805_634_1",
  "launcherOptions": {
    "batchContextId": "123e4567-e89b-12d3-a456-426614174000",
    "jobName": "Monthly Status Report for New York",
    "requiredResources": "gpuRequired",
    "workloadQueueName": "Priority Queue"
  },
  "restartType": "job",
  "listFile": "/my/path/in/my/batch/server/pod/@FILESETID@/mySASPgm-@STARTTIME@.lst",
  "logFile": "/my/path/in/my/batch/server/pod/@FILESETID@/mySASPgm-@STARTTIME@.log",
  "outputDir": "/my/path/in/my/batch/server/pod/@FILESETID@",
  "sasProgramName": "myTestProgram.sas",
  "sasOptions": "-memsize 2048",
  "watchOutput": true
}

Response

The job was created.

createdBystring

The username of whoever created the resource.

modifiedBystring

The username of whoever last modified the resource.

creationTimeStampstring date-time

The timestamp for when the resource was created.

modifiedTimeStampstring date-time

The timestamp for when the resource was last modified.

contextIdstring

Specifies the context ID that is associated with the job.

endedTimeStampstring date-time

If present, it specifies the timestamp when the job ended.

executionHoststring

If the job is running, this is the name of the host on which the job is being processed.

fileSetIdstring

Specifies the ID of the file set to use for transporting files to and from the job.

idstring

Specifies the ID of the job assigned by the Batch service.

namestring

The name of the job

portinteger

If the job is running, this is the port on which the job can be contacted by the Batch service to get the STDOUT information.

processIdstring

The operating system process ID of the job process.

workloadJobIdstring

If SAS Workload Management is in the deployment, this is the SAS Workload Orchestrator job ID.

returnCodeinteger

If the job has finished, this is the return code from the process.

state'pending' | 'running' | 'completed' | 'failed' | 'unknown'

The processing state of the Batch job.

startedTimeStampstring date-time

If present, it specifies the timestamp when the job was started.

submittedTimeStampstring date-time

Specifies the timestamp when the job was submitted.

versioninteger

Specifies the version number of this representation schema. This is version 1.

Example response

{
  "contextId": "16c332b2-4ac6-483b-85f6-7bb9d2d5a576",
  "endedTimeStamp": "2022-06-01T13:55:32Z",
  "executionHost": "myhost01.mycompany.com",
  "fileSetId": "JOB_20220606_182805_634_1",
  "id": "16a46fa5-f866-488d-9cec-92e226bfcf5",
  "name": "Monthly Status Report for New York",
  "port": 23645,
  "processId": "5",
  "workloadJobId": "1375",
  "returnCode": 2,
  "state": "failed",
  "startedTimeStamp": "2022-06-01T13:45:32Z",
  "submittedTimeStamp": "2022-06-01T13:44:32Z"
}

Changes

No recorded changes to this operation across all 1 revision of this API.