Interactive command execution


Manages execution of an interactive process by fetching output and feeding input via subsequent REST calls.

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/iprocesses
Method POST
URL params None
Data params

JSON:

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

Example:

{
  "host": "zeus.cyfronet.pl",
  "command": "bash"
}
  						
Success response

Code: 201

Example:

{
  "process_id":"25a6b082-7ef0-4ec7-8349-c3beb9b341a4",
  "status":"OK",
  "finished":false,
  "standard_output":null,
  "standard_error":null,
  "error_message":null,
  "tag":null
}
  					
Error response

Error response: 408 | 422 | 500

Example:

{
  "process_id":null,
  "status":"ERROR",
  "finished":false,
  "standard_output":null,
  "standard_error":null,
  "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":"zeus.cyfronet.pl", "command":"bash"}' \
--header "Content-Type:application/json" --header "PROXY:$proxy" https://submit.plgrid.pl/api/iprocesses
  								
Notes Input, output and error streams of the interactive process are limited on the rimrock server to 1 MB each. Please ensure that feeding and consuming of the streams does not overfill the buffers.
URL /api/iprocesses/{process_id}
Method GET
URL params process_id - Process identifier (required)
Data params None
Success response

Code: 200

Example:

{
  "process_id":"25a6b082-7ef0-4ec7-8349-c3beb9b341a4",
  "status":"OK",
  "finished":false,
  "standard_output":"some output",
  "standard_error":null,
  "error_message":null,
  "tag":null
}
  					
Error response

Error response: 404 | 500

Example:

{
  "process_id":"25a6b082-7ef0-4ec7-8349-c3beb9b341a4",
  "status":"ERROR",
  "finished":false,
  "standard_output":null,
  "standard_error":null,
  "error_message":"Process with given id could not be 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/iprocesses/25a6b082-7ef0-4ec7-8349-c3beb9b341a4
  					
Notes None
URL /api/iprocesses?tag={tag}
Method GET
URL params tag - Tag value (optional)
Data params None
Success response

Code: 200

Example:

[
  {
    "process_id":"25a6b082-7ef0-4ec7-8349-c3beb9b341a4",
    "status":"OK",
    "finished":false,
    "standard_output":"some output",
    "standard_error":null,
    "error_message":null,
    "tag":null
  },
  {
    "process_id":"905fab54-d0b8-43f4-9e44-7ba7dfc71d74",
    "status":"OK",
    "finished":true,
    "standard_output":"another output",
    "standard_error":null,
    "error_message":null,
    "tag":null
  }
]
  					
Error response

Error response: 404 | 500

Example:

{
  "process_id":null,
  "status":"ERROR",
  "finished":false,
  "standard_output":null,
  "standard_error":null,
  "error_message":"Given proxy certificate is invalid",
  "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/iprocesses
  					
Notes None
URL /api/iprocesses/{process_id}
Method PUT
URL params process_id - Process identifier (required)
Data params

JSON:

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

Example:

{
  "standard_input": "echo hello"
}
  						
Success response

Code: 200

Example:

{
  "process_id":"25a6b082-7ef0-4ec7-8349-c3beb9b341a4",
  "status":"OK",
  "finished":false,
  "standard_output":null,
  "standard_error":null,
  "error_message":null,
  "tag":null
}
  					
Error response

Error response: 404 | 422 | 500

Example:

{
  "process_id":"25a6b082-7ef0-4ec7-8349-c3beb9b341a4",
  "status":"ERROR",
  "finished":false,
  "standard_output":null,
  "standard_error":null,
  "error_message":"Process with given id could not be 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 '{"standard_input":"echo hello"}' --header "Content-Type:application/json" \
--header "PROXY:$proxy" https://submit.plgrid.pl/api/iprocesses/25a6b082-7ef0-4ec7-8349-c3beb9b341a4
  					
Notes None