Grid job submitter


Allows for easy grid job management via a REST interface. User is able to start, monitor, get results and delete running or finished grid 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/gridjobs/gridproxy/{vo}
Method GET
URL params vo - Virtual organization name
Data params None
Success response

Code: 200

Example:

-----BEGIN CERTIFICATE-----
...
...
...
-----END CERTIFICATE-----
Error response

Error response: 408 | 422 | 500

Example:

{
  "status":"error",
  "exit_code":0,
  "error_message":"error message...",
}
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/gridjobs/gridproxy/vo.plgrid.pl
Notes None
URL /api/gridjobs
Method POST
URL params None
Data params

application/x-www-form-urlencoded or multipart/form-data:

executable=[string (required; automatically added to inputSandbox)]
arguments=[string[] (optional)]
stdOutput=[string (optional; automatically added to outputSandbox)]
stdError=[string (optional; automatically added to outputSandbox)]
candidateHosts=[string[] (optional)]
outputSandbox=[string[] (optional)]
files=[file[] (optional; all submitted files are automatically added to inputSandbox)]
tag=[string (optional)]
Success response

Code: 201

Example:

{
  "status":"RUNNING",
  "job_id":"56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a",
  "native_job_id":"https://lb02.grid.cyf-kr.edu.pl:9000/6UVXM9J-Hwjli2WJSYmIKQ"
}
Error response

Error response: 408 | 422 | 500

Example:

{
  "status":"error",
  "exit_code":-1,
  "error_message":"error message...",
  "tag":null
}
  					
Sample call

Bash (with base64, tr and curl)

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

echo First file contents > in1.txt
echo Second file contents > in2.txt
echo -e '#!/bin/bash\ncat in1.txt in2.txt > result.txt' > run.sh

curl -k -X POST --header "PROXY:$proxy" --form files=@run.sh --form files=@in1.txt --form files=@in2.txt \
--form executable=run.sh --form outputSandbox=result.txt --form stdOutput=out.txt \
--form stdError=error.txt https://submit.plgrid.pl/api/gridjobs
  					
Notes Currently it is not possible to use proxy retrieved from the PL-Grid portal and extended with a virtual organization using rimrock. Proxy generated with the voms-proxy-init command should be used.
URL /api/gridjobs/{job_id}/jdl
Method GET
URL params job_id - Job identifier
Data params None
Success response

Code: 200

Example:

[
  Type = "Job";
  JobType = "Normal";
  Executable = "run.sh";
  ...
  ...        
]
Error response

Error response: 408 | 422 | 500

Example:

{
  "status":"error",
  "exit_code":0,
  "error_message":"error message...",
}
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/gridjobs/56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a/jdl
Notes None
URL /api/gridjobs?tag={tag}
Method GET
URL params tag - Tag (optional)
Data params None
Success response

Code: 200

Example:

[
  {
    "status":"RUNNING",
    "job_id":"295a49d3-b261-4acb-a508-fce3e1684494",
    "native_job_id":"https://lb02.grid.cyf-kr.edu.pl:9000/e4QEAZLtYUwTzr1tblH57A"
  },
  {
    "status":"RUNNING",
    "job_id":"56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a",
    "native_job_id":"https://lb02.grid.cyf-kr.edu.pl:9000/6UVXM9J-Hwjli2WJSYmIKQ"
  }
]
Error response

Error response: 408 | 404 | 500

Example:

{
  "status": "error",
  "exit_code": -1,
  "error_message": "error message...",
  "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/gridjobs
Notes None
URL /api/gridjobs/{job_id}
Method GET
URL params job_id - Job identifier
Data params None
Success response

Code: 200

Example:

{
  "status":"RUNNING",
  "job_id":"56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a",
  "native_job_id":"https://lb02.grid.cyf-kr.edu.pl:9000/6UVXM9J-Hwjli2WJSYmIKQ"
}
Error response

Error response: 408 | 404 | 500

Example:

{
  "status": "error",
  "exit_code": -1,
  "error_message": "error message...",
  "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/gridjobs/56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a
Notes None
URL /api/gridjobs/{job_id}/files/{file_name}
Method GET
URL params job_id - Job identifier
file_name - File path relative to sandbox
Data params None
Success response

Code: 200

Example:

File contents
Error response

Error response: 408 | 422 | 500

Example:

{
  "status":"error",
  "exit_code":0,
  "error_message":"error message...",
}
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/gridjobs/56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a/files/result.txt
Notes None
URL /api/gridjobs/{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,
  "error_message": "error message",
  "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/gridjobs/56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a
Notes None
URL /api/gridjobs/{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,
  "error_message": "error message...",
  "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/gridjobs/56cd0b82-2db4-4dd7-ad77-4ceb922f9a7a
Notes None