From 2ae2020b8331ec61a5b47447e96efc63f343a7cd Mon Sep 17 00:00:00 2001 From: Rob Bovill Date: Fri, 13 Sep 2024 15:38:17 -0700 Subject: [PATCH 1/6] Removed MainTel Camera state transition scripts and configs, as these will now be handled by the test harness explicitly. Updated tests/test_enabled_offline.py and tests/test_maintel_state_transitions.py accordingly. --- ...nabled_offline_state_transition_configs.py | 13 ----- .../maintel_state_transition_configs.py | 13 ----- .../ts/IntegrationTests/enabled_offline.py | 2 - .../maintel_disabled_enabled.py | 56 ++++-------------- .../maintel_standby_disabled.py | 58 ++++--------------- tests/test_enabled_offline.py | 2 +- tests/test_maintel_state_transitions.py | 8 +-- 7 files changed, 26 insertions(+), 126 deletions(-) diff --git a/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py b/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py index 7d16333a..1c9826cf 100644 --- a/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py +++ b/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py @@ -126,19 +126,6 @@ yaml_string, explicit_start=True, canonical=True ) -# MainTel Camera enabled_offline -yaml_string = yaml.safe_load( - """ - data: - - [MTHeaderService, OFFLINE] - - [MTOODS, OFFLINE] - """ -) - -registry["maintel_camera_enabled_offline"] = yaml.safe_dump( - yaml_string, explicit_start=True, canonical=True -) - # GenCam enabled_offline yaml_string = yaml.safe_load( """ diff --git a/python/lsst/ts/IntegrationTests/configs/maintel_state_transition_configs.py b/python/lsst/ts/IntegrationTests/configs/maintel_state_transition_configs.py index 2e6543f5..d274c1f9 100644 --- a/python/lsst/ts/IntegrationTests/configs/maintel_state_transition_configs.py +++ b/python/lsst/ts/IntegrationTests/configs/maintel_state_transition_configs.py @@ -81,16 +81,3 @@ registry["maintel_disabled_enabled"] = yaml.safe_dump( yaml_string, explicit_start=True, canonical=True ) - -# maintel_camera_disabled_enabled -yaml_string = yaml.safe_load( - """ - data: - - [replace_me_HeaderService, ENABLED] - - [replace_me_OODS, ENABLED] - """ -) - -registry["maintel_camera_disabled_enabled"] = yaml.safe_dump( - yaml_string, explicit_start=True, canonical=True -) diff --git a/python/lsst/ts/IntegrationTests/enabled_offline.py b/python/lsst/ts/IntegrationTests/enabled_offline.py index 8a5d330d..5365ccc0 100644 --- a/python/lsst/ts/IntegrationTests/enabled_offline.py +++ b/python/lsst/ts/IntegrationTests/enabled_offline.py @@ -45,7 +45,6 @@ class EnabledOffline(BaseScript): registry["mtcs_enabled_offline"], registry["eas_enabled_offline"], registry["maintel_enabled_offline"], - registry["maintel_camera_enabled_offline"], registry["gencam_enabled_offline"], # The ScriptQueue script must run last. registry["sq_enabled_offline"], @@ -60,7 +59,6 @@ class EnabledOffline(BaseScript): ("set_summary_state.py", BaseScript.is_standard), ("set_summary_state.py", BaseScript.is_standard), ("set_summary_state.py", BaseScript.is_standard), - ("set_summary_state.py", BaseScript.is_standard), ] def __init__(self) -> None: diff --git a/python/lsst/ts/IntegrationTests/maintel_disabled_enabled.py b/python/lsst/ts/IntegrationTests/maintel_disabled_enabled.py index d5c939d6..8ca96f3b 100644 --- a/python/lsst/ts/IntegrationTests/maintel_disabled_enabled.py +++ b/python/lsst/ts/IntegrationTests/maintel_disabled_enabled.py @@ -24,11 +24,9 @@ import asyncio -import yaml from lsst.ts.IntegrationTests import BaseScript from .configs.config_registry import registry -from .utils import get_test_env_arg class MainTelDisabledEnabled(BaseScript): @@ -39,56 +37,22 @@ class MainTelDisabledEnabled(BaseScript): """ index: int = 1 - configs: tuple = ( - registry["maintel_disabled_enabled"], - registry["maintel_camera_disabled_enabled"], - ) + configs: tuple = (registry["maintel_disabled_enabled"],) scripts: list = [ ("set_summary_state.py", BaseScript.is_standard), - ("set_summary_state.py", BaseScript.is_standard), ] - def __init__(self, test_env: str) -> None: + def __init__(self) -> None: super().__init__() - # Set the MainTel Camera based on the test environment. - self.test_env = test_env - self.big_cam_configs = yaml.safe_load( - registry["maintel_camera_disabled_enabled"] - ) - if test_env.lower() == "bts": - # Running on BTS with MTCamera - self.big_cam_hs = "MTHeaderService" - self.big_cam_oods = "MTOODS" - else: - # Running on TTS or Summit with CCCamera - self.big_cam_hs = "CCHeaderService" - self.big_cam_oods = "CCOODS" - self.big_cam_configs["data"][0][0] = self.big_cam_hs - self.big_cam_configs["data"][1][0] = self.big_cam_oods - self.configs = ( - registry["maintel_disabled_enabled"], - yaml.safe_dump(self.big_cam_configs), - ) def run_maintel_disabled_enabled() -> None: - # Ensure the invocation is correct. - # If not, raise KeyError. - # If it is correct, execute the state transition. - args = get_test_env_arg() - try: - script_class = MainTelDisabledEnabled( - test_env=args.test_env, - ) - except KeyError as ke: - print(repr(ke)) - else: - num_scripts = len(script_class.scripts) - print( - f"\nMainTel Disabled to Enabled; " - f"running {num_scripts} scripts" - f"on the '{args.test_env}' environment, " - f"with this configuration: \n" - f"{script_class.configs}" - ) + script_class = MainTelDisabledEnabled() + num_scripts = len(script_class.scripts) + print( + f"\nMainTel Disabled to Enabled; " + f"running {num_scripts} scripts" + f"with this configuration: \n" + f"{script_class.configs}" + ) asyncio.run(script_class.run()) diff --git a/python/lsst/ts/IntegrationTests/maintel_standby_disabled.py b/python/lsst/ts/IntegrationTests/maintel_standby_disabled.py index 7016563d..c9bdf387 100644 --- a/python/lsst/ts/IntegrationTests/maintel_standby_disabled.py +++ b/python/lsst/ts/IntegrationTests/maintel_standby_disabled.py @@ -24,11 +24,9 @@ import asyncio -import yaml from lsst.ts.IntegrationTests import BaseScript from .configs.config_registry import registry -from .utils import get_test_env_arg class MainTelStandbyDisabled(BaseScript): @@ -39,56 +37,22 @@ class MainTelStandbyDisabled(BaseScript): """ index: int = 1 - configs: tuple = ( - registry["maintel_standby_disabled"], - registry["maintel_camera_standby_disabled"], - ) + configs: tuple = (registry["maintel_standby_disabled"],) scripts: list = [ ("set_summary_state.py", BaseScript.is_standard), - ("set_summary_state.py", BaseScript.is_standard), ] - def __init__(self, test_env: str) -> None: + def __init__(self) -> None: super().__init__() - # Set the MainTel Camera based on the test environment. - self.test_env = test_env - self.big_cam_configs = yaml.safe_load( - registry["maintel_camera_standby_disabled"] - ) - if test_env.lower() == "bts": - # Running on BTS with MTCamera - self.big_cam_hs = "MTHeaderService" - self.big_cam_oods = "MTOODS" - else: - # Running on TTS or Summit with CCCamera - self.big_cam_hs = "CCHeaderService" - self.big_cam_oods = "CCOODS" - self.big_cam_configs["data"][0][0] = self.big_cam_hs - self.big_cam_configs["data"][1][0] = self.big_cam_oods - self.configs = ( - registry["maintel_standby_disabled"], - yaml.safe_dump(self.big_cam_configs), - ) def run_maintel_standby_disabled() -> None: - # Ensure the invocation is correct. - # If not, raise KeyError. - # If it is correct, execute the state transition. - args = get_test_env_arg() - try: - script_class = MainTelStandbyDisabled( - test_env=args.test_env, - ) - except KeyError as ke: - print(repr(ke)) - else: - num_scripts = len(script_class.scripts) - print( - f"\nMainTel Standby to Disabled; " - f"running {num_scripts} scripts " - f"on the '{args.test_env}' environment, " - f"with this configuration: \n" - f"{script_class.configs}" - ) - asyncio.run(script_class.run()) + script_class = MainTelStandbyDisabled() + num_scripts = len(script_class.scripts) + print( + f"\nMainTel Standby to Disabled; " + f"running {num_scripts} scripts " + f"with this configuration: \n" + f"{script_class.configs}" + ) + asyncio.run(script_class.run()) diff --git a/tests/test_enabled_offline.py b/tests/test_enabled_offline.py index fe3ebba5..04835eb1 100644 --- a/tests/test_enabled_offline.py +++ b/tests/test_enabled_offline.py @@ -59,7 +59,7 @@ async def test_enabled_offline(self) -> None: # Assert script was added to ScriptQueue. self.assertEqual(len(self.controller.queue_list), num_scripts) # Assert scripts passed. - self.assertEqual(script_class.script_states, [8, 8, 8, 8, 8, 8, 8, 8, 8, 8]) + self.assertEqual(script_class.script_states, [8, 8, 8, 8, 8, 8, 8, 8, 8]) async def asyncTearDown(self) -> None: await self.controller.close() diff --git a/tests/test_maintel_state_transitions.py b/tests/test_maintel_state_transitions.py index 638c26a7..77fccf7a 100644 --- a/tests/test_maintel_state_transitions.py +++ b/tests/test_maintel_state_transitions.py @@ -52,7 +52,7 @@ async def test_maintel_standby_disabled(self) -> None: """ # Instantiate the MainTelStandbyDisabled integration tests. - script_class = MainTelStandbyDisabled(test_env="bts") + script_class = MainTelStandbyDisabled() # Get number of scripts num_scripts = len(script_class.scripts) print(f"MainTel Standby to Disabled; running {num_scripts} scripts") @@ -61,7 +61,7 @@ async def test_maintel_standby_disabled(self) -> None: # Assert script was added to ScriptQueue. self.assertEqual(len(self.controller.queue_list), num_scripts) # Assert scripts passed. - self.assertEqual(script_class.script_states, [8, 8]) + self.assertEqual(script_class.script_states, [8]) async def test_maintel_disabled_enabled(self) -> None: """Execute the MainTelDisabledEnabled integration test script, @@ -71,7 +71,7 @@ async def test_maintel_disabled_enabled(self) -> None: """ # Instantiate the MainTelDisabledEnabled integration tests. - script_class = MainTelDisabledEnabled(test_env="tts") + script_class = MainTelDisabledEnabled() # Get number of scripts num_scripts = len(script_class.scripts) print(f"MainTel Disabled to Enabled; running {num_scripts} scripts") @@ -80,7 +80,7 @@ async def test_maintel_disabled_enabled(self) -> None: # Assert script was added to ScriptQueue. self.assertEqual(len(self.controller.queue_list), num_scripts) # Assert scripts passed. - self.assertEqual(script_class.script_states, [8, 8]) + self.assertEqual(script_class.script_states, [8]) async def asyncTearDown(self) -> None: await self.controller.close() From 6b70eed29c171be3d99b8cf096fb199705f571b1 Mon Sep 17 00:00:00 2001 From: Rob Bovill Date: Mon, 16 Sep 2024 11:34:56 -0700 Subject: [PATCH 2/6] Added 'mtrotator' to the ignore list in enabled_offline_state_transition_configs.py. This is now handled individually by the test harness, to avoid it faulting while the ordering in offline_mtcs.py is incorrect. --- .../configs/enabled_offline_state_transition_configs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py b/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py index 1c9826cf..f0ad8fdd 100644 --- a/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py +++ b/python/lsst/ts/IntegrationTests/configs/enabled_offline_state_transition_configs.py @@ -105,6 +105,7 @@ """ ignore: - mtptg + - mtrotator """ ) From 88f673ac164d66244a262a287741879aad585f33 Mon Sep 17 00:00:00 2001 From: Rob Bovill Date: Mon, 16 Sep 2024 11:37:34 -0700 Subject: [PATCH 3/6] Update version-history. --- doc/version-history.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/version-history.rst b/doc/version-history.rst index 90389eb0..fa9ba06f 100644 --- a/doc/version-history.rst +++ b/doc/version-history.rst @@ -10,6 +10,11 @@ Version History .. No new work should be required in order to complete this section. .. Below is an example of a version history format. +v0.28.0 +------- +* Removed MainTel Camera state transition scripts and configs. +* Add MTRotator to ignore list in enabled_offline_state_transition_configs.py. + v0.27.0 ------- * Fixed CSC list to remove indexed instances of OCPS. From 955a2fe4d19056ef51b1dedb9d1ac959892ba874 Mon Sep 17 00:00:00 2001 From: Rob Bovill Date: Wed, 1 May 2024 14:42:33 -0700 Subject: [PATCH 4/6] Moved the callback definition to a point after the script indexes list definition, since the callback references that list. --- python/lsst/ts/IntegrationTests/base_script.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/lsst/ts/IntegrationTests/base_script.py b/python/lsst/ts/IntegrationTests/base_script.py index 8c1322aa..8d670241 100644 --- a/python/lsst/ts/IntegrationTests/base_script.py +++ b/python/lsst/ts/IntegrationTests/base_script.py @@ -184,9 +184,6 @@ async def run(self) -> None: # Since `async with` is used, # you do NOT have to wait for the remote to start - # Create the callback to the ScriptQueue Script Event that - # will wait for all the scripts to complete. - self.remote.evt_script.callback = self.wait_for_done # Convert the queue_placement parameter to the approprirate # ScriptQueue.Location Enum object. queue_placement = getattr(Location, self.queue_placement.upper()) @@ -213,6 +210,9 @@ async def run(self) -> None: # Copy the script_indexes list to use in the Script Event callback. # This maintains the integrity of the real script_indexes list. self.temp_script_indexes = copy.deepcopy(script_indexes) + # Create the callback to the ScriptQueue Script Event that + # will wait for all the scripts to complete. + self.remote.evt_script.callback = self.wait_for_done # Resume the ScriptQueue to begin script execution. await self.remote.cmd_resume.set_start(timeout=10) # Wait for the scripts to complete. From 239823e936b7ffe052bcd5c5d40a0f12e92c001b Mon Sep 17 00:00:00 2001 From: Rob Bovill Date: Mon, 23 Sep 2024 15:58:41 -0700 Subject: [PATCH 5/6] Updated the empty config in auxtel_housekeeping.py to use double-quotes. --- python/lsst/ts/IntegrationTests/auxtel_housekeeping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/lsst/ts/IntegrationTests/auxtel_housekeeping.py b/python/lsst/ts/IntegrationTests/auxtel_housekeeping.py index b708620d..9b03500f 100644 --- a/python/lsst/ts/IntegrationTests/auxtel_housekeeping.py +++ b/python/lsst/ts/IntegrationTests/auxtel_housekeeping.py @@ -38,7 +38,7 @@ class AuxTelHousekeeping(BaseScript): index: int = 2 configs: tuple = ( - [], + "", registry["atdome_home"], registry["atdome_park"], registry["atptg_park"], From 31a1afeea537a3669e953588d46522977442803e Mon Sep 17 00:00:00 2001 From: Rob Bovill Date: Mon, 23 Sep 2024 16:32:25 -0700 Subject: [PATCH 6/6] Updated version-history. --- doc/version-history.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/version-history.rst b/doc/version-history.rst index fa9ba06f..a298155b 100644 --- a/doc/version-history.rst +++ b/doc/version-history.rst @@ -14,6 +14,8 @@ v0.28.0 ------- * Removed MainTel Camera state transition scripts and configs. * Add MTRotator to ignore list in enabled_offline_state_transition_configs.py. +* Moved the callback definition in base_script.py. +* Fixed an empty-config definition. v0.27.0 -------