R Server
These resources are for managing the R server process running in the background: status, start and stop.
Status
- GET /rserver
Get the server detailed status, including R server and host’s system information.
This entry point requires Authentication of a user with
administrator
ormanager
role.Example requests
Using cURL
curl --user administrator:password https://rock-demo.obiba.org/rserver
Using R (rockr)
library(rockr) conn <- rockr.connect(username="administrator", password="password", url = "https://rock-demo.obiba.org") rockr.status(conn)
Example response
HTTP/1.1 200 OK Content-Type: application/json { "id": "rock-demo", "version": "4.0.3", "encoding": "utf8", "tags": [ "default" ], "running": true, "sessions": { "total": 0, "busy": 0 }, "system": { "cores": 16, "freeMemory": 8938140 } }
- Response JSON Object
id (string) – The server identifier.
version (string) – The R version.
encoding (string) – String encoding when communicating with the R server.
tags (strings) – Array of strings, used to identify to what is the R server cluster.
running (boolean) – Whether the R server is running or not.
sessions.total (integer) – Number of R sessions (active of waiting).
sessions.busy (integer) – Number of active R sessions (i.e. an R expression is being executed).
system.cores (integer) – Number of host’s system cores. If the number of cores cannot be retrieved (when R server is stopped for instance),
-1
is returned.system.freeMemory (integer) – Available host’s system memory in KB. If the available memory cannot be retrieved (when R server is stopped for instance),
-1
is returned.
- Request Headers
Authorization – As described in the Authentication section
Accept –
*/*
- Response Headers
Content-Type –
application/json
- Status Codes
200 OK – Server is alive and functional.
401 Unauthorized – User is not authenticated.
403 Forbidden – User does not have the appropriate role for this operation.
500 Internal Server Error – Server is alive but not functional.
Start
- PUT /rserver
Start the R server. Ignored if the R server is already running.
This entry point requires Authentication of a user with
administrator
ormanager
role.Example requests
Using cURL
curl --user administrator:password -X PUT https://rock-demo.obiba.org/rserver
Using R (rockr)
library(rockr) conn <- rockr.connect(username="administrator", password="password", url = "https://rock-demo.obiba.org") rockr.start(conn)
- Request Headers
Authorization – As described in the Authentication section
- Status Codes
200 OK – Server is alive and functional.
401 Unauthorized – User is not authenticated.
403 Forbidden – User does not have the appropriate role for this operation.
500 Internal Server Error – Server is alive but not functional.
Stop
- DELETE /rserver
Stop the R server. Ignored if the R server is not running. Be aware that all R sessions will be terminated.
This entry point requires Authentication of a user with
administrator
ormanager
role.Example requests
Using cURL
curl --user administrator:password -X DELETE https://rock-demo.obiba.org/rserver
Using R (rockr)
library(rockr) conn <- rockr.connect(username="administrator", password="password", url = "https://rock-demo.obiba.org") rockr.stop(conn)
- Request Headers
Authorization – As described in the Authentication section
- Status Codes
200 OK – Server is alive and functional.
401 Unauthorized – User is not authenticated.
403 Forbidden – User does not have the appropriate role for this operation.
500 Internal Server Error – Server is alive but not functional.
Log
- GET /rserver/_log?limit=(int: max_lines)
Download the last lines of the R server console output. Can be useful when debugging R problems.
This entry point requires Authentication of a user with
administrator
ormanager
role.Example requests
Using cURL
curl --user administrator:password -H "Accept: text/plain" https://rock-demo.obiba.org/rserver/_log?limit=100
Using R (rockr)
library(rockr) conn <- rockr.connect(username="administrator", password="password", url = "https://rock-demo.obiba.org") rockr.log(conn, 100)
- Query Parameters
limit (integer) – The maximum number of lines to tail from the R server log. Default is
1000
.
- Request Headers
Authorization – As described in the Authentication section
Accept –
text/plain
- Response Headers
Content-Type –
text/plain
- Status Codes
200 OK – Server is alive and functional.
401 Unauthorized – User is not authenticated.
403 Forbidden – User does not have the appropriate role for this operation.
500 Internal Server Error – Server is alive but not functional.