Skip to content

Commit

Permalink
Remove old plugin system docs and use of 'agent-paths' config
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianJKoopman committed Sep 19, 2024
1 parent 90c7138 commit d82a5a5
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 78 deletions.
43 changes: 0 additions & 43 deletions docs/developer/site_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ the CrossbarConfig class:
:members: from_dict
:noindex:

The significance of ``agent-paths`` is described more in
:ref:`agent_plugins`.

InstanceConfig
--------------

Expand Down Expand Up @@ -205,43 +202,3 @@ river_ctrl.py in the examples):
print('Starting a data acquisition process...')
d1 = yield cw.start()
#...
.. _agent_plugins:
Agent Script Discovery
======================
Agent scripts are currently written as stand-alone python scripts (and
thus not not importable through the main ``ocs`` python module). To
support automatic launching of Agents, ``site_config`` includes a
plugin-style system to register Agent scripts. This is flexible
enough to support both the natively packaged Agents and any
"third-party" agents needed in a particular installation. The system
works like this:
- A bundle of Agent scripts is assembled at some location. There are
no restrictions on where these scripts can live in the file system.
For example, a script called ``riverbank_agent.py`` might live in
``/simonsobs/agents/``.
- A special "registration script" is written, with a filename of the
form ``ocs_plugin_*.py``. This script should live in Python's
import path, or else (and this is better), the path to the script
should be included in the ``agent-paths`` variable in the SCF for
this host. For example, we might put the file in ``/simonsobs/agents``
and call it ``ocs_plugin_simonsobs.py``.
- When the site_config system (specifically the HostManager agent)
needs to find a particular agent script, it:
- Adds any directories in ``agent-paths`` to the Python import path.
- Scans through all importable modules, and imports them if they
match the ``ocs_plugin_*`` name pattern.
- The ``ocs_plugin`` script makes calls into ocs to associate a
particular script filenames to agent class names. In our example,
``ocs_plugin_simonsobs.py`` would call
``ocs.site_config.register_agent_class('RiverBank',
'/simonsobs/agents/riverbank_agent.py')``.
A good example of a plugin script can be found in the OCS agents
directory, ``ocs_plugins_standard.py``.
5 changes: 0 additions & 5 deletions docs/user/centralized_management.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,6 @@ block would become:
# Directory for logs.
'log-dir': '/simonsobs/log/ocs/',
# List of additional paths to Agent plugin modules.
'agent-paths': [
'/simonsobs/ocs/agents/',
],
# Description of host-1's Agents.
# We have two readout devices; they are both Lakeshore 240. But they can
# be distinguished, on startup, by a device serial number.
Expand Down
6 changes: 0 additions & 6 deletions docs/user/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ structure.
# Directory for logs.
'log-dir': '/home/<user>/log/ocs/',

# List of additional paths to Agent plugin modules.
'agent-paths': [
'/home/<user>/git/ocs/agents/',
'/home/<user>/git/socs/agents/',
],

# Agents running directly on the host machine
# Note: We aren't going to run this Agent in the quickstart example,
# but this gives a good example of configuring an agent directly
Expand Down
10 changes: 0 additions & 10 deletions docs/user/site_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ instances (running two different classes of agent):
# Directory for logs.
'log-dir': '/simonsobs/log/ocs/',
# List of additional paths to Agent plugin modules.
'agent-paths': [
'/simonsobs/ocs/agents/',
],
# Description of host-1's Agents.
# We have two readout devices; they are both Lakeshore 240. But they can
# be distinguished, on startup, by a device serial number.
Expand Down Expand Up @@ -89,11 +84,6 @@ instances (running two different classes of agent):
# Directory for logs.
'log-dir': '/simonsobs/log/ocs/',
# List of additional paths to Agent plugin modules.
'agent-paths': [
'/simonsobs/ocs/agents/',
],
# Description of host-2's Agents.
# We have two devices; another Lakeshore 240, and the OCS g3 file
# Aggregator.
Expand Down
2 changes: 1 addition & 1 deletion example/miniobs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In particular:

- The list of Agents is defined under hostname ``localhost``. This is
a wildcard that can only work in a single-host system.
- ``log-dir``, ``agent-paths``, and the ``crossbar:config-dir`` are
- ``log-dir`` and the ``crossbar:config-dir`` are
all specified as relative paths. Behavior will be unpredictable if
Agents are not all invoked in the same working directory.

Expand Down
4 changes: 0 additions & 4 deletions example/miniobs/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ hosts:
localhost: {
'crossbar': {'config-dir': './dot_crossbar/'},
'log-dir': './logs',
'agent-paths': [
'../../agents/',
'./',
],
'agent-instances': [
{'agent-class': 'HostManager',
'instance-id': 'hm1',
Expand Down
6 changes: 0 additions & 6 deletions ocs/site_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class HostConfig:
def __init__(self, name=None):
self.instances = []
self.name = name
self.agent_paths = []
self.log_dir = None
self.working_dir = os.getcwd()
self.crossbar_timeout = None
Expand All @@ -86,10 +85,6 @@ def from_dict(cls, data, parent=None, name=None):
``agent-instances`` (required)
A list of AgentConfig descriptions.
``agent-paths`` (optional)
A list of additional paths where OCS is permitted to
search for Agent plugin modules.
``crossbar`` (optional)
Settings to assist with starting / stopping / monitoring a
crossbar server running on this host. There is a single
Expand All @@ -109,7 +104,6 @@ def from_dict(cls, data, parent=None, name=None):
self.parent = parent
self.data = data
self.instances = data['agent-instances']
self.agent_paths = data.get('agent-paths', [])
self.crossbar = CrossbarConfig.from_dict(data.get('crossbar'))
self.log_dir = data.get('log-dir', None)
self.crossbar_timeout = data.get('crossbar_timeout', 10)
Expand Down
3 changes: 0 additions & 3 deletions tests/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ hosts:

localhost: {
'log-dir': './log/',
'agent-paths': [
'../agents/',
],
'agent-instances': [
{'agent-class': 'HostManager',
'instance-id': 'host-manager-1',
Expand Down

0 comments on commit d82a5a5

Please sign in to comment.