Job submitter


Allows for easy job management via a REST interface. User is able to start, monitor, get the results and delete running or finished jobs.

Security note! All the methods described below are secured. Authentication requires sending a user proxy certificate (support for SimpleCA signed proxies only) through a request header with the PROXY name and a Base64 encoded proxy as the value.
URL /api/jobs
Method POST
URL params None
Data params

JSON:

{
  "host": [string (required)],
  "working_directory": [string (optional)],
  "script": [string (required)]
  "tag": [string (optional)]
}

Warning! By default working_directory is set to user home directory. As a consequence when two or more jobs are started with default working_directory value at the same time then job script may be overwritten.
Example:

{
  "host": "prometheus.cyfronet.pl",
  "working_directory": "/people/username/testjob",
  "script": "#!/bin/bash\necho hello\nexit 0"
}
  								
Success response

Code: 201

Example:

{
  "job_id":"50463091.batch.grid.cyf-kr.edu.pl",
  "stdout_path":"/stdout/path",
  "stderr_path":"/stderr/path",
  "status":"QUEUED",
  "tag":null
}
  								
Error response

Error response: 408 | 422 | 500

Example:

{
  "status":"error",
  "exit_code":-1,
  "standard_output":"whatever was printed before timeout",
  "error_output":"",
  "error_message":"timeout occurred...",
  "tag":null
}
  					
Sample call

Bash (with base64, tr and curl)

proxy="`cat {path-to-proxy-file} | base64 | tr -d '\n'`"

curl -k -X POST --data '{"host":"prometheus.cyfronet.pl", "script":"#!/bin/bash\n#SBATCH -A {grantid}\necho hello\nexit 0"}' \
--header "Content-Type:application/json" --header "PROXY:$proxy" https://submit.plgrid.pl/api/jobs

curl -k -X POST --data '{"host":"ares.cyfronet.pl", "script":"#!/bin/bash\n#SBATCH -A {grantid}\necho hello\nexit 0"}' \
--header "Content-Type:application/json" --header "PROXY:$proxy" https://submit.plgrid.pl/api/jobs

curl -k -X POST --data '{"host":"athena.cyfronet.pl", "script":"#!/bin/bash\n#SBATCH -A {grantid}\necho hello\nexit 0"}' \
--header "Content-Type:application/json" --header "PROXY:$proxy" https://submit.plgrid.pl/api/jobs
							    
Notes None
URL /api/jobs?tag={tag}&format={short}&job_id={id1}&job_id={id2})
Method GET
URL params
  • tag - Tag value (optional).
  • format - Format (optional). When format is set to "short" only job statuses are returned. Resource usage for finished jobs are not checked.
  • job_id - When given only these job ids statuses will be checked and returned.
Data params None
Success response

Code: 200

Warning! Job runtime information (attributes: nodes, cores, start_time, end_time, wall_time, queue_time) is available up to one minute after job completes.
Example:

[
  {
    "job_id":"50463091.batch.grid.cyf-kr.edu.pl",
    "stdout_path":"/stdout/path",
    "stderr_path":"/stderr/path",
    "status":"QUEUED",
    "tag":null
  }, {
    "job_id":"61473291.batch.grid.cyf-kr.edu.pl",
    "stdout_path":"/stdout/path",
    "stderr_path":"/stderr/path",
    "status":"FINISHED",
    "tag":null
  }, {
    "job_id":"34532479.batch.grid.cyf-kr.edu.pl",
    "stdout_path":"/stdout/path",
    "stderr_path":"/stderr/path",
    "status":"FINISHED",
    "tag":null,
    "nodes": "1",
    "cores": "12",
    "start_time": "2015-01-07 15:00:11",
    "end_time": "2015-01-07 15:01:11",
    "wall_time": "00:01:00",
    "queue_time": "00:10:00"
  }
]
  					
Error response

Error response: 408 | 404 | 500

Example:

{
  "status": "error",
  "exit_code": 0,
  "standard_output": "",
  "error_output": "",
  "error_message": "Job with 1234.batch.grid.cyf-kr.edu.pl not found",
  "tag":null
}
  					
Sample call

Bash (with base64, tr and curl)

proxy="`cat {path-to-proxy-file} | base64 | tr -d '\n'`"

curl -k -X GET --header "PROXY:$proxy" https://submit.plgrid.pl/api/jobs
  					
Notes None
URL /api/jobs/{job_id}
Method GET
URL params job_id - Job identifier
Data params None
Success response

Code: 200

Warning! Job runtime information (attributes: nodes, cores, start_time, end_time, wall_time, queue_time) is available up to one minute after job completes.
Example:

{
  "job_id":"50463091.batch.grid.cyf-kr.edu.pl",
  "stdout_path":"/stdout/path",
  "stderr_path":"/stderr/path",
  "status":"QUEUED",
  "tag":null,
  "nodes": "1",
  "cores": "12",
  "start_time": "2015-01-07 15:00:11",
  "end_time": "2015-01-07 15:01:11",
  "wall_time": "00:01:00",
  "queue_time": "00:10:00"
}
  					
Error response

Error response: 408 | 404 | 500

Example:

{
  "status": "error",
  "exit_code": 0,
  "standard_output": "",
  "error_output": "",
  "error_message": "Job with 1234.batch.grid.cyf-kr.edu.pl not found",
  "tag":null
}
  					
Sample call

Bash (with base64, tr and curl)

proxy="`cat {path-to-proxy-file} | base64 | tr -d '\n'`"

curl -k -X GET --header "PROXY:$proxy" https://submit.plgrid.pl/api/jobs/50463091.batch.grid.cyf-kr.edu.pl
  					
Notes None
URL /api/jobs/{job_id}
Method DELETE
URL params job_id - Job identifier
Data params None
Success response Code: 204
Error response

Error response: 408 | 404 | 500

Example:

{
  "status": "error",
  "exit_code": 0,
  "standard_output": "",
  "error_output": "",
  "error_message": "Job with 1234.batch.grid.cyf-kr.edu.pl not found",
  "tag":null
}
  					
Sample call

Bash (with base64, tr and curl)

proxy="`cat {path-to-proxy-file} | base64 | tr -d '\n'`"

curl -k -X DELETE --header "PROXY:$proxy" https://submit.plgrid.pl/api/jobs/50463091.batch.grid.cyf-kr.edu.pl
  					
Notes None
URL /api/jobs/{job_id}
Method PUT
URL params job_id - Job identifier
Data params

JSON:

{
  "action": [string (required)]
}

Example:

{
  "action": "abort"
}
  								
Success response Code: 204
Error response

Error response: 408 | 404 | 500

Example:

{
  "status": "error",
  "exit_code": 0,
  "standard_output": "",
  "error_output": "",
  "error_message": "Job with 1234.batch.grid.cyf-kr.edu.pl not found",
  "tag":null
}
  								
Sample call

Bash (with base64, tr and curl)

proxy="`cat {path-to-proxy-file} | base64 | tr -d '\n'`"

curl -k -X PUT --data '{"action":"abort"}' --header "Content-Type:application/json" --header "PROXY:$proxy" https://submit.plgrid.pl/api/jobs/50463091.batch.grid.cyf-kr.edu.pl
  					
Notes None