Supervisor

Supervisor

This tool runs on the robot and is responsible for managing releases. This includes both executing software processes, monitoring them, and handling deploys (for both software and ArkOS).

The Supervisor is controlled through the standard Ark message commands. It exposes a web server on port 8081. You can communicate with it through the messages defined in ark/supervisor/messages.rbuf, or use the ark-supervisor-tool to control it from the command line.

Command Line Tools

You can query the Platform Supervisor of its current status like so:

./build/ark-supervisor-tool --query
Supervisor Status:
{
  "processes": [
    {
      "last_return_code": 0,
      "last_terminating_signal": 0,
      "name": "Nano Data Collection Pipeline",
      "output_contents": "<...>",
      "start_count": 1,
      "state": "Running"
    }
  ]
}

There are also options for starting/stopping processes. You can use the --start-all or --stop-all command line arguments to start/stop the process.

Finally, you can watch standard output using --watch:

./build/ark-supervisor-tool --watch -o "Data Collection"
(2021-06-07 13:00:26.320) [info] (websocket_client.cc:417) Established connection to 127.0.0.1:8081 and subscribed to '/status'.
(2021-06-07 12:59:29.620) [warn] (video_device.cc:945) Requested control 'gain' not supported by device.
(2021-06-07 12:59:29.620) [warn] (video_device.cc:945) Requested control 'override_enable' not supported by device.
(2021-06-07 12:59:29.620) [warn] (video_device.cc:945) Requested control 'sensor_mode' not supported by device.

Because you can interact with the Supervisor through normal Ark communications, its possible for you to control software updates, monitor the console, or restart software from within your web or Qt applications.

Custom Command Line Options

You can start processes on the Supervisor with customized command line options, which can make testing/iterating faster.

For example:

./build/ark-supervisor-tool --host localhost:8081 --start-all --start-with-arguments 'Data Collection Pipeline' -- --initial-log-name 'Testing'

Assuming the processes were stopped, running that will start the data collection pipeline with custom command line arguments that start logging on startup. You can pass in any command line arguments you want to the processes.

You can also modify the config package (or any of its child files) directly, and simply start that process with your local config package:

./build/ark-supervisor-tool --host localhost:8081 --start-all --start-with-arguments 'Data Collection Pipeline' --start-with-config-package ./ark/data_collection/data_collection_nuc.yml

That command starts the data collection pipeline with the config package on your local machine. One caveat is that if the process crashes, or you restart it, it will restart with the original command line arguments.

Since this can be used to run with customized configurations or command lines, it is recommended that you only use this for testing.