Barebones Agent
The Barebones Agent is provided with OCS to provide a starting point for Agent development. It is heavily used throughout the Agent development guide.
Configuration File Examples
Below are configuration examples for the ocs config file and for running the Agent in a docker container.
OCS Site Config
To configure the Fake Data Agent we need to add a FakeDataAgent block to our ocs configuration file. Here is an example configuration block using all of the available arguments:
{'agent-class': 'BarebonesAgent',
'instance-id': 'barebones-1',
'arguments': []},
Docker Compose
An example docker compose configuration:
ocs-barebones-1:
image: simonsobs/ocs:latest
hostname: ocs-docker
environment:
- LOGLEVEL=info
- INSTANCE_ID=barebones-1
volumes:
- ${OCS_CONFIG_DIR}:/config:ro
Agent API
- class ocs.agents.barebones.agent.BarebonesAgent(agent)[source]
Barebone Agent demonstrating writing an Agent from scratch.
This Agent is meant to be an example for Agent development, and provides a clean starting point when developing a new Agent.
- Parameters:
agent (OCSAgent) – OCSAgent object from
ocs.ocs_agent.init_site_agent()
.
- agent
OCSAgent object from
ocs.ocs_agent.init_site_agent()
.- Type:
- log
Logger object used to log events within the Agent.
- Type:
txaio.tx.Logger
- lock
TimeoutLock object used to prevent simultaneous commands being sent to hardware.
- Type:
- _count
Internal tracking of whether the Agent should be counting or not. This is used to exit the Process loop by changing it to False via the count.stop() command. Your Agent won’t use this exact attribute, but might have a similar one.
- Type:
bool