From 2a42ec13bfbe7635809692c53bbe830be6045d4d Mon Sep 17 00:00:00 2001 From: Rob Bovill Date: Fri, 26 Jan 2024 12:15:03 -0700 Subject: [PATCH] Removed all environment-based configuration from enabled_offline.py. Those CSCs are now handled individually. Updated the unit test accordingly. --- .../ts/IntegrationTests/enabled_offline.py | 56 +------------------ tests/test_enabled_offline.py | 4 +- 2 files changed, 4 insertions(+), 56 deletions(-) diff --git a/python/lsst/ts/IntegrationTests/enabled_offline.py b/python/lsst/ts/IntegrationTests/enabled_offline.py index bcc1c001..9367858f 100644 --- a/python/lsst/ts/IntegrationTests/enabled_offline.py +++ b/python/lsst/ts/IntegrationTests/enabled_offline.py @@ -22,10 +22,8 @@ __all__ = ["EnabledOffline", "run_enabled_offline"] -import argparse import asyncio -import yaml from lsst.ts.IntegrationTests import BaseScript from .configs.config_registry import registry @@ -45,7 +43,6 @@ class EnabledOffline(BaseScript): [], [], [], - [], registry["eas_enabled_offline"], registry["maintel_enabled_offline"], registry["gencam_enabled_offline"], @@ -58,70 +55,22 @@ class EnabledOffline(BaseScript): ("auxtel/offline_atcs.py", BaseScript.is_standard), ("auxtel/offline_latiss.py", BaseScript.is_standard), ("maintel/offline_mtcs.py", BaseScript.is_standard), - ("replace_with_big_camera_offline_script", BaseScript.is_standard), ("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, test_env: str) -> None: + def __init__(self) -> None: super().__init__() - # Set the OCPS index based on test environment - self.test_env = test_env - self.obssys_configs = yaml.safe_load(self.configs[1]) - if self.test_env.lower() == "bts": - # Running on BTS with MTCamera and OCPS:3 - self.big_cam_script = "maintel/offline_lsstcam.py" - self.ocps = "OCPS:3" - else: - # Running on TTS or Summit with CCCamera and OCPS:2 - self.big_cam_script = "maintel/offline_comcam.py" - self.ocps = "OCPS:2" - self.obssys_configs["data"][3][0] = self.ocps - # Update the self.configs tuple with the updated - # registry["sched_ocps_enabled_offline"] configuration. - # Do this by converting the tuple to a list, replacing the - # updated entry and converting it back to a tuple. - self.obssys_configs = yaml.safe_load(self.configs[1]) - temp_list = list(self.configs) - temp_list[1] = yaml.safe_dump( - self.obssys_configs, explicit_start=True, canonical=True - ) - self.configs = tuple(temp_list) - # Update the self.scripts tuple with the proper Camera - # shutdown script, based on the environment. - temp_scripts = list(self.scripts) - temp_scripts[5] = self.big_cam_script - self.scripts = tuple(temp_scripts) def run_enabled_offline() -> None: - # Define the script arguments. - parser = argparse.ArgumentParser() - parser.add_argument( - "test_env", - nargs="?", - type=str.lower, - choices=["bts", "tts", "summit"], - help="Specify on which environment the tests are running (case insensitive).", - ) - args = parser.parse_args() - # Print the help if the environment is not defined. - if not (args.test_env): - parser.print_help() - exit() - main(args) - - -def main(opts: argparse.Namespace) -> None: # Ensure the invocation is correct. # If not, raise KeyError. # If it is correct, execute the state transition. try: - script_class = EnabledOffline( - test_env=opts.test_env, - ) + script_class = EnabledOffline() except KeyError as ke: print(repr(ke)) else: @@ -129,7 +78,6 @@ def main(opts: argparse.Namespace) -> None: print( f"\nEnabled to Offline; " f"running {num_scripts} scripts " - f"on the '{opts.test_env}' environment. " f"with this configuration: \n" f"{script_class.configs}" ) diff --git a/tests/test_enabled_offline.py b/tests/test_enabled_offline.py index 6f1f1f12..04835eb1 100644 --- a/tests/test_enabled_offline.py +++ b/tests/test_enabled_offline.py @@ -50,7 +50,7 @@ async def test_enabled_offline(self) -> None: """ # Instantiate the EnabledOffline integration tests. - script_class = EnabledOffline(test_env="bts") + script_class = EnabledOffline() # Get number of scripts num_scripts = len(script_class.scripts) print(f"Enabled to Offline; running {num_scripts} scripts") @@ -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()