tomato.tomato package

tomato.tomato: command line interface to the tomato daemon

Code author: Peter Kraus

Module of functions to interact with tomato. Includes basic tomato daemon functions:

  • status() to query the status of the tomato daemon

  • start() to start a new tomato daemon

  • stop() to stop a running tomato daemon

  • init() to create a default settings.toml file

  • reload() to process the settings.toml and devices.yml files again

Also includes the following pipeline management functions:

tomato.tomato.set_loglevel(delta: int)
tomato.tomato.load_device_file(yamlpath: Path) dict
tomato.tomato.get_pipelines(devs: dict[str, Device], pipelines: list) tuple[dict[str, Pipeline], dict[str, Component]]
tomato.tomato.status(*, port: int, timeout: int, context: Context, **_: dict) Reply

Get status of the tomato daemon.

Examples

>>> # Status with a running daemon
>>> tomato status
Success: tomato running on port 1234
>>> # Status without a running daemon
>>> tomato status
Failure: tomato not running on port 1234
>>> # Status of a running daemon with data
>>> tomato status -y
data:
  appdir: /home/kraus/.config/tomato/1.0rc2.dev2
  cmps:
    [...]
  devs:
    [...]
  drvs:
    [...]
  jobs:
    [...]
  logdir: /home/kraus/.cache/tomato/1.0rc2.dev2/log
  nextjob: 1
  pips:
    [...]
  port: 1234
  settings:
    [...]
  status: running
  verbosity: 20
msg: tomato running on port 1234
success: true
tomato.tomato.start(*, port: int, timeout: int, context: Context, appdir: str, logdir: str, verbosity: int, **_: dict) Reply

Start the tomato daemon.

Examples

>>> # Start tomato
>>> tomato start
Success: tomato on port 1234 reloaded with settings from /home/kraus/.config/tomato/1.0rc2.dev2
>>> # Start tomato with a custom port
>>> tomato start -p 1235
Success: tomato on port 1235 reloaded with settings from /home/kraus/.config/tomato/1.0rc2.dev2
>>> # Start tomato with another tomato running
>>> tomato start
Failure: required port 1234 is already in use, choose a different one
tomato.tomato.stop(*, port: int, timeout: int, context: Context, **_: dict) Reply

Stop a running tomato daemon.

Will not stop the daemon if any jobs are running. Will create a state snapshot.

Examples

>>> # Stop tomato daemon without running jobs
>>> tomato stop
Success: tomato on port 1234 closed successfully
>>> # Attempt to stop tomato daemon with running jobs
>>> tomato stop
Failure: jobs are running
>>> # Attempt to stop tomato daemon which is not running
>>> tomato stop -p 1235
Failure: tomato not running on port 1235
tomato.tomato.init(*, appdir: str, datadir: str, **_: dict) Reply

Create a default settings.toml file.

Will overwrite any existing settings.toml file.

Examples

>>> tomato init
Success: wrote default settings into /home/kraus/.config/tomato/1.0rc2.dev2/settings.toml
tomato.tomato.reload(*, port: int, timeout: int, context: Context, appdir: str, **_: dict) Reply

Reload settings.toml and devices.yaml files and reconfigure tomato daemon.

Examples

>>> # Reload with compatible changes
>>> tomato reload
Success: tomato on port 1234 reloaded with settings from /home/kraus/.config/tomato/1.0rc2.dev2
tomato.tomato.pipeline_load(*, port: int, timeout: int, context: Context, pipeline: str, sampleid: str, **_: dict) Reply

Load a sample into a pipeline. Usage:

tomato pipeline load <pipeline> <sampleid>
tomato.tomato.pipeline_eject(*, port: int, timeout: int, context: Context, pipeline: str, **_: dict) Reply

Eject any sample present in a pipeline. Usage:

tomato pipeline eject <pipeline>
tomato.tomato.pipeline_ready(*, port: int, timeout: int, context: Context, pipeline: str, **_: dict) Reply

Mark pipeline as ready. Usage:

pipeline ready <pipeline>