You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/quickstart.rst
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,6 +141,7 @@ The following concepts are used in **tomato**:
141
141
142
142
pip3[pipeline 3] -.-> c3
143
143
144
+
.. _settings-file:
144
145
145
146
Settings file
146
147
`````````````
@@ -212,6 +213,8 @@ Additional, *driver*-specific settings may be provided in this section. Each *dr
212
213
213
214
Further *driver*-specific settings, such as ``dllpath`` or ``calibration``, can be specified here. All of these *driver*-specific settings are passed to each *driver* when its process is launched and the :class:`DriverInterface` is initialised, and can therefore contain paths to various libraries or other files necessary for the *driver* to function.
214
215
216
+
.. _devices-file:
217
+
215
218
Devices file
216
219
````````````
217
220
This ``yaml``-formatted file contains information about each *device*, corresponding to an individual piece of hardware managed by **tomato**, as well as information about the organisation of the individually-addressable *components* of those *devices* into *pipelines*.
@@ -344,4 +347,4 @@ As of ``tomato-2.0``, the :obj:`task_params` specified in the *payload* are vali
The function called when `tomato-daemon` is executed.
39
+
The function called when :obj:`tomato-daemon` is executed.
43
40
44
-
Manages the state of the tomato daemon, including recovery of state via
45
-
:mod:`~tomato.daemon.io`, processing state updates via :mod:`~tomato.daemon.cmd`,
46
-
and the manager threads for both jobs (:mod:`~tomato.daemon.job`) and drivers
47
-
(:mod:`~tomato.daemon.driver`).
41
+
Manages the state of the tomato daemon, spawning manager threads for jobs (:mod:`~tomato.daemon.job`), drivers (:mod:`~tomato.daemon.driver`), and pipelines (:mod:`~tomato.daemon.pip`). Parses the configuration in the :ref:`settings file <settings-file>` and :ref:`devices file <devices-file>`.
Copy file name to clipboardExpand all lines: src/tomato/daemon/cmd.py
+13-12Lines changed: 13 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,7 @@
4
4
.. codeauthor::
5
5
Peter Kraus
6
6
7
-
All functions in this module expect a :class:`dict` containing the command specification
8
-
and a :class:`~tomato.models.Daemon` object as arguments. The :class:`Daemon` object is
9
-
altered by the command.
7
+
All functions in this module expect a :class:`dict` containing the command specification and a :class:`~tomato.models.Daemon` object as arguments. The :class:`~tomato.models.Daemon` object may be altered by the command.
10
8
11
9
All functions in this module return a :class:`~tomato.models.Reply`.
12
10
@@ -27,10 +25,12 @@
27
25
28
26
29
27
defstatus(msg: dict, daemon: Daemon) ->Reply:
28
+
"""Return daemon status, containing the current tomato configuration."""
returnReply(success=True, msg="daemon set to stop")
45
45
46
46
47
-
defsetup(msg: dict, daemon: Daemon) ->Reply:
48
-
logger=logging.getLogger(f"{__name__}.setup")
47
+
defreload(msg: dict, daemon: Daemon) ->Reply:
48
+
"""
49
+
Set-up or reload the tomato daemon using its configuration files.
50
+
51
+
.. note::
52
+
53
+
When reloading settings, tomato checks whether any running jobs use resources (i.e. drivers, pipelines, components) that would be removed if the new configuration were to be applied. If this is the case, the configuration **will not be updated**.
Function that attempts to register all configured components for this driver.
44
+
45
+
This helper function is executed when the ``register`` command is set to the driver process. The daemon is first polled for up-to-date configuration, and then each of the returned components is registered, if necessary, using :func:`cmp_register` of the driver interface.
46
+
47
+
In case the registration fails, a limited number of retries (as specified by the ``MAX_REGISTER_RETRIES`` constant) can be attempted on subsequent runs of this function.
This function periodically runs the :func:`cmp_measure` on each component on the driver. The interval is determined from driver configuration using the ``"idle_measurement_interval"`` setting, driver defaults using the :obj:`interface.idle_measurement_interval` object, or tomato default (``IDLE_MEASUREMENT_INTERVAL``).
91
+
92
+
.. note::
93
+
94
+
How idle measurements are handled is up to the individual driver. By default, the :func:`cmp_measure` function will not submit new measurements when a task or a measurement is already running.
This function is useful if the driver port is unknown or not responsive.
134
+
135
+
Wrapper around :func:`psutil.terminate`. Here we kill the (grand)children of the process with the name of `tomato-job`, i.e. the individual task functions. This allows the `tomato-job` process to exit gracefully once the task functions join.
99
136
100
-
Here we kill the (grand)children of the process with the name of `tomato-job`,
101
-
i.e. the individual task functions. This allows the `tomato-job` process to exit
102
-
gracefully once the task functions join.
137
+
.. note::
103
138
104
-
Note that on Windows, the `tomato-job.exe` process has two children: a `python.exe`
105
-
which is the actual process running the job, and `conhost.exe`, which we want to
106
-
avoid killing.
139
+
On Windows, the `tomato-job.exe` process has two children: a `python.exe` process which is the actual process running the job, and `conhost.exe` process, which we want to avoid killing.
The function called when `tomato-driver` is executed.
123
156
124
-
This function is responsible for managing all activities involving devices of a
125
-
single driver type.
157
+
This function is responsible for managing all activities involving devices of a single driver type.
126
158
127
-
First, the list of devices (and their channel/address) for the specified driver is
128
-
fetched from the `tomato-daemon`. Then, a new instance of the specified driver is
129
-
spawned, populating its device map using the above list. If successful, the current
130
-
process information is fed back to the `tomato-daemon`.
159
+
First, the list of devices (and their channel/address) for the specified driver is fetched from the `tomato-daemon`. Then, a new instance of the specified driver is spawned, populating its device map using the above list. The state of the driver is stored .
131
160
132
-
Afterwards, the main loop handles all requests related to each of the devices
133
-
managed by this driver process, including job commands. Finally, if the driver is
134
-
instructed to stop, it attempts to perform a teardown before exiting.
161
+
Afterwards, the main loop handles all requests related to each of the devices managed by this driver process, including job commands. Finally, if the driver is instructed to stop, it attempts to perform a teardown before exiting.
This manager ensures individual driver processes are (re-)spawned and instructed to
314
-
quit as necessary.
333
+
This manager ensures individual driver processes are (re-)spawned and instructed to quit as necessary. The drivers are periodically checked using the ``HEARTBEAT`` constant as the interval. All changes are stored in the drivers table.
Merges the individual pickled :class:`xr.Datasets` of each Component found in :obj:`job.jobpath`
24
-
into a single :class:`xr.DataTree`, which is then stored in the NetCDF file,
25
-
using the Component `role` as the group label.
23
+
Merges all of the individual pickled :class:`~xarray.Dataset` files from each component found in :obj:`job.jobpath` into a single :class:`~xarray.DataTree`, which is then stored in the NetCDF file. The role of each component is used as the group label.
Dumps the data provided as :class:`xr.Dataset` into a ``pickle``. Concatenates with
56
-
any existing data stored in the ``pickle``.
53
+
Dumps the data provided as :class:`~xarray.Dataset` using :mod:`pickle`. Concatenates the new data with any existing data stored in the existing ``.pkl`` file.
0 commit comments