From 7e3b4bd36781e7af09773a0a3ff39a6a316eb2ea Mon Sep 17 00:00:00 2001 From: Jack Lashner Date: Mon, 27 Nov 2023 10:43:44 -0500 Subject: [PATCH] Add except for caget failure (#576) * Adds except for caget failure * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add pyepics as dependency for pysmurf-controller agent --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Brian Koopman --- docs/agents/pysmurf-controller.rst | 6 ++++++ docs/user/installation.rst | 2 ++ requirements.txt | 1 + setup.py | 15 ++++++++------- socs/agents/pysmurf_controller/agent.py | 3 ++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/agents/pysmurf-controller.rst b/docs/agents/pysmurf-controller.rst index 8ff5c9ac5..d0bbbc864 100644 --- a/docs/agents/pysmurf-controller.rst +++ b/docs/agents/pysmurf-controller.rst @@ -33,6 +33,12 @@ These can be installed via pip: $ python -m pip install 'sodetlib @ git+https://github.com/simonsobs/sodetlib.git@master' $ python -m pip install 'sotodlib @ git+https://github.com/simonsobs/sotodlib.git@master' +Additionally, ``socs`` should be installed with the ``pysmurf`` group: + +.. code-block:: bash + + $ pip install -U socs[pysmurf] + Configuration File Examples ----------------------------------- diff --git a/docs/user/installation.rst b/docs/user/installation.rst index ce1f0f580..c1406ebe5 100644 --- a/docs/user/installation.rst +++ b/docs/user/installation.rst @@ -30,6 +30,8 @@ The different groups, and the agents they provide dependencies for are: - Magpie Agent * - ``pfeiffer`` - Pfeiffer TC 400 Agent + * - ``pysmurf`` + - Pysmurf Controller Agent * - ``smurf_sim`` - SMuRF File Emulator, SMuRF Stream Simulator * - ``synacc`` diff --git a/requirements.txt b/requirements.txt index 1f74fe79b..f7b09b7c1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -35,6 +35,7 @@ pandas pfeiffer-vacuum-protocol==0.4 # pysmurf controller +pyepics pysmurf @ git+https://github.com/slaclab/pysmurf.git@main sodetlib @ git+https://github.com/simonsobs/sodetlib.git@master sotodlib @ git+https://github.com/simonsobs/sotodlib.git@master diff --git a/setup.py b/setup.py index 37b6f2274..82de72509 100644 --- a/setup.py +++ b/setup.py @@ -37,11 +37,12 @@ pfeiffer_deps = ['pfeiffer-vacuum-protocol==0.4'] # Pysmurf Controller Agent -# pysmurf_deps = [ -# 'pysmurf @ git+https://github.com/slaclab/pysmurf.git@main', -# 'sodetlib @ git+https://github.com/simonsobs/sodetlib.git@master', -# 'sotodlib @ git+https://github.com/simonsobs/sotodlib.git@master', -# ] +pysmurf_deps = [ + 'pyepics', + # 'pysmurf @ git+https://github.com/slaclab/pysmurf.git@main', + # 'sodetlib @ git+https://github.com/simonsobs/sodetlib.git@master', + # 'sotodlib @ git+https://github.com/simonsobs/sotodlib.git@master', +] # SMuRF File Emulator, SMuRF Stream Simulator smurf_sim_deps = ['so3g'] @@ -60,7 +61,7 @@ # Note: Not including the holograph deps, which are Python 3.8 only. Also not # including any dependencies with only direct references. all_deps = acu_deps + labjack_deps + magpie_deps + pfeiffer_deps + \ - smurf_sim_deps + synacc_deps + timing_master_deps + pysmurf_deps + smurf_sim_deps + synacc_deps + timing_master_deps all_deps = list(set(all_deps)) setup( @@ -119,7 +120,7 @@ 'labjack': labjack_deps, 'magpie': magpie_deps, 'pfeiffer': pfeiffer_deps, - # 'pysmurf': pysmurf_deps, + 'pysmurf': pysmurf_deps, 'smurf_sim': smurf_sim_deps, 'synacc': synacc_deps, 'timing_master': timing_master_deps, diff --git a/socs/agents/pysmurf_controller/agent.py b/socs/agents/pysmurf_controller/agent.py index 5e7204550..0b62ba914 100644 --- a/socs/agents/pysmurf_controller/agent.py +++ b/socs/agents/pysmurf_controller/agent.py @@ -12,6 +12,7 @@ import time from typing import Optional +import epics import numpy as np import sodetlib as sdl from ocs import ocs_agent, site_config @@ -316,7 +317,7 @@ def check_state(self, session, params=None): stream_id=cfg.stream_id, ) session.data.update(d) - except RuntimeError: + except (RuntimeError, epics.ca.ChannelAccessGetFailure): self.log.warn("Could not connect to epics server! Waiting and " "then trying again")