Skip to content

Commit

Permalink
Removed all environment-based configuration from enabled_offline.py. …
Browse files Browse the repository at this point in the history
…Those CSCs are now handled individually.
  • Loading branch information
rbovill committed Jan 26, 2024
1 parent 6226d97 commit b790dc0
Showing 1 changed file with 2 additions and 54 deletions.
56 changes: 2 additions & 54 deletions python/lsst/ts/IntegrationTests/enabled_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -45,7 +43,6 @@ class EnabledOffline(BaseScript):
[],
[],
[],
[],
registry["eas_enabled_offline"],
registry["maintel_enabled_offline"],
registry["gencam_enabled_offline"],
Expand All @@ -58,78 +55,29 @@ 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:
num_scripts = len(script_class.scripts)
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}"
)
Expand Down

0 comments on commit b790dc0

Please sign in to comment.