From 75a81e298a53fe2d2e8ddbb4a9744a4a93fa0bd3 Mon Sep 17 00:00:00 2001 From: David Nguyen Date: Fri, 16 Aug 2024 18:29:59 +0000 Subject: [PATCH] address comments --- docs/agents/http_camera.rst | 10 +++++++--- setup.py | 3 ++- socs/agents/http_camera/agent.py | 7 +++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/docs/agents/http_camera.rst b/docs/agents/http_camera.rst index e507a49ce..edfba0f98 100644 --- a/docs/agents/http_camera.rst +++ b/docs/agents/http_camera.rst @@ -23,22 +23,26 @@ Agent in a docker container. OCS Site Config ``````````````` -To configure the HTTP Camera Agent we need to add a HTTPCameraAgent +To configure the HTTP Camera Agent we need to add an HTTPCameraAgent block to our ocs configuration file. Here is an example configuration block using all of the available arguments:: {'agent-class': 'HTTPCameraAgent', 'instance-id': 'cameras', 'arguments': [['--mode', 'acq'], - ['--config-file', 'config_file.yaml']]}, + ['--config-file', 'cameras.yaml']]}, .. note:: The ``--config-file`` argument should be the config file path relative to ``OCS_CONFIG_DIR`` and contain an entry for each camera with - relevant information. An example can be found at `config`_. + relevant information. An example is given here which is also found + at `config`_. .. _config: https://github.com/simonsobs/socs/blob/main/socs/agents/http_camera/sample_config.yaml +.. literalinclude:: ../../../socs/agents/http_camera/sample_config.yaml + :language: yaml + Docker Compose `````````````` diff --git a/setup.py b/setup.py index 8b8cac456..56b0d40bc 100644 --- a/setup.py +++ b/setup.py @@ -73,7 +73,8 @@ package_data={'socs': [ 'agents/smurf_file_emulator/*.yaml', 'agents/labjack/cal_curves/*.txt', - 'agents/generator/*.yaml' + 'agents/generator/*.yaml', + 'agents/http_camera/*.yaml' ]}, entry_points={ 'console_scripts': [ diff --git a/socs/agents/http_camera/agent.py b/socs/agents/http_camera/agent.py index 67910b2af..17bae3ca1 100644 --- a/socs/agents/http_camera/agent.py +++ b/socs/agents/http_camera/agent.py @@ -113,8 +113,12 @@ def acq(self, session, params=None): elif camera['brand'] == 'acti': payload = {'USER': camera['user'], 'PWD': camera['password'], - 'SNAPSHOT': camera['resolution']} + 'SNAPSHOT': camera.get('resolution', 'N640x480,100')} url = f"http://{camera['address']}/cgi-bin/encoder" + else: + self.log.info(f"{camera['brand']} is an unsupported camera brand. Skipping this config block.") + self.config['cameras'].remove(camera) + continue # Format directory and filename ctime = int(timestamp) @@ -137,7 +141,6 @@ def acq(self, session, params=None): data[camera['location']]['last_attempt'] = time.time() data[camera['location']]['connected'] = connected continue - camera['connected'] = True self.log.debug("Received screenshot from camera.") # Write screenshot to file and update latest file