Skip to content

Commit 9f99635

Browse files
committed
Update all callbacks to be asynchronous.
1 parent 0ba20b4 commit 9f99635

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎python/lsst/ts/scriptqueue/queue_model.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ async def _remove_script(self, sal_index):
712712
else:
713713
await self._update_queue()
714714

715-
def _log_message_callback(self, data):
715+
async def _log_message_callback(self, data):
716716
"""Print Script logMessage data to stdout.
717717
718718
To use: if self.verbose is true then set this as a callback

‎python/lsst/ts/scriptqueue/run_one_script.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ async def run_one_script(index, script, config, loglevel=None):
167167
)
168168
await remote.start_task
169169

170-
def log_callback(data):
170+
async def log_callback(data):
171171
iso_time = datetime.datetime.now().time().isoformat(timespec="milliseconds")
172172
print(f"{iso_time} {logging.getLevelName(data.level)}: {data.message}")
173173

‎python/lsst/ts/scriptqueue/script_queue_commander.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ async def script_heartbeat_monitor(self):
148148
f"heartbeat not seen in {HEARTBEAT_ALARM_INTERVAL} seconds"
149149
)
150150

151-
def script_log_message(self, data):
151+
async def script_log_message(self, data):
152152
exception_str = (
153153
(
154154
f", traceback={data.traceback}, "
@@ -165,7 +165,7 @@ def script_log_message(self, data):
165165
f"message={data.message}{exception_str}"
166166
)
167167

168-
def script_state(self, data):
168+
async def script_state(self, data):
169169
try:
170170
state = ScriptState(data.state)
171171
except ValueError:
@@ -176,7 +176,7 @@ def script_state(self, data):
176176
f"state={state.name}{reason}, lastCheckpoint={data.lastCheckpoint}"
177177
)
178178

179-
def script_heartbeat(self, data):
179+
async def script_heartbeat(self, data):
180180
if data.salIndex != self._script_to_monitor:
181181
# A heartbeat from the wrong script.
182182
return

‎tests/test_run_one_script.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ async def test_run_command_line(self):
175175
# (e.g. [1, 1, 2, 2, 1, 1] becomes [1, 2, 1]
176176
states_seen = []
177177

178-
def state_callback(data):
178+
async def state_callback(data):
179179
nonlocal states_seen
180180
state = ScriptState(data.state)
181181
if not states_seen or state != states_seen[-1]:

0 commit comments

Comments
 (0)