Remote Control
Note
This is is a preliminary implementation
When started with the -c or --control option (see SDRVM for all options), a dedicated web server is started and accepts connections on the TCP port 8001.
The following API is then exposed on http://[sdrvm ip]:8001/api/ :
List of tasks
endpoint : /api/tasks
http method : GET
Returns a JSON object listing the running tasks, the opened radio devices, the mailboxes and the IQQueues existing in the Virtual Machine.
Task description
{
"mailboxes": boolean ,
"name": string,
"os_pid" : int ,
"parent_tid": int ,
"running_time": number,
"state": int,
"state_name": string ,
"tid": int,
"total_allocated": int
}
- mailboxes: true if the task has created mailboxes
- name: name of the task
- os_pid : the Linux PID for the thread
- tid: JS Task identifier (unique)
- parent_tid: identifier of the task who created this task ,
- running_time: total number of seconds elapsed since the task creation,
- state: int,
- state_name: string ,
- total_allocated: number of bytes allocated for the task
Example
{
"devices":[],
"mailboxes":[],
"queues":[],
"tasks":[
{
"mailboxes":false,
"name":"master",
"os_pid":52841,
"parent_tid":0,
"running_time":7.486000061035156,
"state":2,
"state_name":"tsSleeping",
"tid":4,
"total_allocated":170041
},
{
"mailboxes":false,
"name":"slave",
"os_pid":52842,
"parent_tid":0,
"running_time":7.479000091552734,
"state":2,
"state_name":"tsSleeping",
"tid":5,
"total_allocated":169465
}
]
}
Start a new task
endpoint : /api/tasks
http method : POST
parameters :
- command=run
- script=[file name to start]
Returns :
- 200 OK : A task has been started
- 500 Error : The file was not found or the task creation refused.
Example :
wget --post-data "command=run&script=boot_concurrentSQL.js" http://localhost:8001/api/tasks -O /dev/null
Kill a task
endpoint : /api/tasks
http method : POST
parameters :
- command=kill
- pid=[task id]
Example :
wget --post-data "command=kill&pid=0" http://localhost:8001/api/tasks -O /dev/null
Last update: July 8, 2022