Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.29.0 Release #134

Merged
merged 9 commits into from
Dec 9, 2024
6 changes: 6 additions & 0 deletions doc/version-history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ Version History
.. No new work should be required in order to complete this section.
.. Below is an example of a version history format.

v0.29.0
-------
* ESS index updates.
* Add support for ScriptQueue:3.
* Improvements to csc_state_transition script. Remove CSC index argument. Add ScriptQueue index argument.

v0.28.0
-------
* Removed MainTel Camera state transition scripts and configs.
Expand Down
9 changes: 5 additions & 4 deletions python/lsst/ts/IntegrationTests/base_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,21 @@

class BaseScript:
"""Defines the common attributes and functions for an
AuxTel or MainTel script.
AuxTel, MainTel or OCS script.

Notes
-----
Use index=1 for MainTel, 2 for AuxTel. The index is defined as a class
Use index=1 for MainTel, 2 for AuxTel or 3 for OCS
(Observatory Control System). The index is defined as a class
attribute for simplicity. The sub-Classes define which index,
if necessary.
The BaseScript class defaults to index=1, as the most common option.

Attributes
----------
index : `int`
The index represents the Main Telescope, index=1, or the
Auxilliary Telescope, index=2.
The index represents the Main Telescope, index=1, the
Auxilliary Telescope, index=2, or OCS, index=3.
is_standard : boolean
Variable used to specify the script as Standard; value is True.
Used for readability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@
- [DIMM:1, DISABLED]
- [DIMM:2, DISABLED]
- [ESS:1, DISABLED]
- [ESS:101, DISABLED]
- [ESS:102, DISABLED]
- [ESS:103, DISABLED]
- [ESS:104, DISABLED]
- [ESS:105, DISABLED]
- [ESS:106, DISABLED]
- [ESS:107, DISABLED]
- [ESS:108, DISABLED]
- [ESS:109, DISABLED]
- [ESS:110, DISABLED]
- [ESS:111, DISABLED]
- [ESS:112, DISABLED]
- [ESS:113, DISABLED]
- [ESS:201, DISABLED]
- [ESS:202, DISABLED]
- [ESS:203, DISABLED]
- [ESS:204, DISABLED]
- [ESS:205, DISABLED]
- [ESS:301, DISABLED]
"""
)
Expand All @@ -62,19 +63,20 @@
- [DIMM:1, ENABLED]
- [DIMM:2, ENABLED]
- [ESS:1, ENABLED]
- [ESS:101, ENABLED]
- [ESS:102, ENABLED]
- [ESS:103, ENABLED]
- [ESS:104, ENABLED]
- [ESS:105, ENABLED]
- [ESS:106, ENABLED]
- [ESS:107, ENABLED]
- [ESS:108, ENABLED]
- [ESS:109, ENABLED]
- [ESS:110, ENABLED]
- [ESS:111, ENABLED]
- [ESS:112, ENABLED]
- [ESS:113, ENABLED]
- [ESS:201, ENABLED]
- [ESS:202, ENABLED]
- [ESS:203, ENABLED]
- [ESS:204, ENABLED]
- [ESS:205, ENABLED]
- [ESS:301, ENABLED]
"""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,23 @@
yaml_string = yaml.safe_load(
"""
data:
- [DREAM, OFFLINE]
- [DSM:2, OFFLINE]
- [DSM:1, OFFLINE]
- [DIMM:1, OFFLINE]
- [DIMM:2, OFFLINE]
- [EPM:1, OFFLINE]
- [ESS:1, OFFLINE]
- [ESS:101, OFFLINE]
- [ESS:102, OFFLINE]
- [ESS:103, OFFLINE]
- [ESS:104, OFFLINE]
- [ESS:105, OFFLINE]
- [ESS:106, OFFLINE]
- [ESS:107, OFFLINE]
- [ESS:108, OFFLINE]
- [ESS:109, OFFLINE]
- [ESS:110, OFFLINE]
- [ESS:111 OFFLINE]
- [ESS:112 OFFLINE]
- [ESS:113 OFFLINE]
- [ESS:201, OFFLINE]
- [ESS:202, OFFLINE]
- [ESS:203, OFFLINE]
Expand All @@ -91,8 +95,8 @@
data:
- [Test:42, OFFLINE]
- [ScriptQueue:1, OFFLINE]
- [ScriptQueue:2, OFFLINE]
- [ScriptQueue:3, OFFLINE]
- [ScriptQueue:2, OFFLINE]
"""
)

Expand Down Expand Up @@ -139,3 +143,15 @@
registry["gencam_enabled_offline"] = yaml.safe_dump(
yaml_string, explicit_start=True, canonical=True
)

# ATBuilding
yaml_string = yaml.safe_load(
"""
data:
- [ATBuilding, OFFLINE]
"""
)

registry["atbuilding_enabled_offline"] = yaml.safe_dump(
yaml_string, explicit_start=True, canonical=True
)
57 changes: 20 additions & 37 deletions python/lsst/ts/IntegrationTests/csc_state_transition.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class CSCStateTransition(BaseScript):
The index value for the indexed-CSC.
state : `str`
The state to transition.
sq_index : `int`
The index of the ScriptQueue to use to run the state transition.
additional_configuration : `str`
Any additional state-transition configuration items.
"""
Expand All @@ -55,26 +57,17 @@ def __init__(
self,
csc: str,
state: str,
csc_index: int = 0,
sq_index: int,
additional_configuration: str = "",
) -> None:
super().__init__()
self.csc = csc
self.csc_index = csc_index
self.state = state
self.index = sq_index
self.added_config = additional_configuration
# Set the ScriptQueue index based on which telescope.
if csc[:2].lower() == "at":
self.index = 2
else:
self.index = 1
# Construct the intermediate configuration list.
# Convert the list to a string.
if self.csc_index:
full_csc_name = f"{self.csc}:{self.csc_index}"
else:
full_csc_name = self.csc
temp_config = [full_csc_name, self.state]
temp_config = [self.csc, self.state]
if self.added_config:
temp_config.append(self.added_config)
config = ", ".join(str(i) for i in temp_config)
Expand All @@ -93,36 +86,30 @@ def __init__(


def csc_state_transition() -> None:
# Define the lists of CSC and State options.
csc_list = list(utils.cscs)
csc_list.sort()
# Define the State options lists.
state_list = list(utils.csc_states)
state_list.sort()
# Define the script arguments.
parser = argparse.ArgumentParser()
parser.add_argument(
"csc",
metavar="csc",
nargs="?",
metavar="csc[:index]",
type=str,
choices=csc_list,
help="Specify which CSC to command (case sensitive).",
help="Specify which CSC[:index] to command (case sensitive).",
)
parser.add_argument(
"state",
metavar="state",
nargs="?",
type=str,
choices=state_list,
help="Specify to which state to transition.",
)
parser.add_argument(
"-x",
"--csc_index",
metavar="index",
nargs="?",
"sq_index",
metavar="scriptqueue_index",
type=int,
help="Define the index of the CSC, if applicable.",
choices=[1, 2, 3],
help="Specify which ScriptQueue to use.",
)
parser.add_argument(
"-a",
Expand All @@ -138,21 +125,16 @@ def csc_state_transition() -> None:
help="Print the allowed options.",
)
args = parser.parse_args()
# Print the help if the camera is not defined,
# or info is not passed.
if not (args.info or args.csc or args.state):
if args.info:
parser.print_help()
exit()
if args.info:
print(
f"\nThe allowed options are:\n"
f" csc:\t{csc_list}\n\n"
f" state:\t{state_list}\n"
)
# Print the help if the CSC or STATE is not defined.
if not (args.csc or args.state):
parser.print_help()
exit()
if args.csc not in utils.cscs:
if args.csc.split(":")[0] not in utils.cscs:
print(
f"Invalid CSC: {args.csc}. "
f"Invalid CSC: {args.csc.split(':')[0]}. "
f"Perhaps it is misspelled or not properly capitalized."
)
parser.print_help()
Expand All @@ -168,7 +150,7 @@ def main(opts: argparse.Namespace) -> None:
script_class = CSCStateTransition(
csc=opts.csc,
state=opts.state,
csc_index=opts.csc_index,
sq_index=opts.sq_index,
additional_configuration=opts.additional_configuration,
)
except KeyError as ke:
Expand All @@ -177,6 +159,7 @@ def main(opts: argparse.Namespace) -> None:
print(
f"\nTransitioning the {opts.csc.upper()} "
f"to the {opts.state} state."
f"\nRunning on ScriptQueue {opts.sq_index}."
f"\nConfiguration: {script_class.configs}."
)
asyncio.run(script_class.run())
2 changes: 2 additions & 0 deletions python/lsst/ts/IntegrationTests/enabled_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class EnabledOffline(BaseScript):
registry["sched_ocps_enabled_offline"],
"",
"",
registry["atbuilding_enabled_offline"],
registry["mtcs_enabled_offline"],
registry["eas_enabled_offline"],
registry["maintel_enabled_offline"],
Expand All @@ -54,6 +55,7 @@ class EnabledOffline(BaseScript):
("set_summary_state.py", BaseScript.is_standard),
("auxtel/offline_atcs.py", BaseScript.is_standard),
("auxtel/offline_latiss.py", BaseScript.is_standard),
("set_summary_state.py", BaseScript.is_standard),
("maintel/offline_mtcs.py", BaseScript.is_standard),
("set_summary_state.py", BaseScript.is_standard),
("set_summary_state.py", BaseScript.is_standard),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_csc_state_transitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def asyncSetUp(self) -> None:
async def test_comcam_offline_standby(self) -> None:
"""Execute the Offline-to-Standby state transition for ComCam."""
# Instantiate the CSCStateTransition integration test.
script_class = CSCStateTransition(csc="CCCamera", state="Standby")
script_class = CSCStateTransition(csc="CCCamera", state="Standby", sq_index=1)
# Get number of scripts
num_scripts = len(script_class.scripts)
print(f"ComCam Offline to Standby; running {num_scripts} scripts")
Expand All @@ -57,7 +57,7 @@ async def test_comcam_offline_standby(self) -> None:
async def test_lsstcam_offline_standby(self) -> None:
"""Execute the Offline-to-Standby state transition for LSSTCam."""
# Instantiate the CSCStateTransition integration tests.
script_class = CSCStateTransition(csc="MTCamera", state="Standby")
script_class = CSCStateTransition(csc="MTCamera", state="Standby", sq_index=1)
# Get number of scripts
num_scripts = len(script_class.scripts)
print(f"LSSTCam Offline to Standby; running {num_scripts} scripts")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_enabled_offline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
self.assertEqual(script_class.script_states, [8, 8, 8, 8, 8, 8, 8, 8, 8, 8])

async def asyncTearDown(self) -> None:
await self.controller.close()
Expand Down
Loading