From dc4166dc5b6436b7862fb1f918705b84fa13a555 Mon Sep 17 00:00:00 2001 From: Dan Hatton Date: Tue, 17 Sep 2024 20:22:17 +0100 Subject: [PATCH 1/4] Fix multigrid_watcher endpoint --- src/murfey/server/api/instrument.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/murfey/server/api/instrument.py b/src/murfey/server/api/instrument.py index bf352c4fb..a3118f74b 100644 --- a/src/murfey/server/api/instrument.py +++ b/src/murfey/server/api/instrument.py @@ -72,12 +72,13 @@ async def start_multigrid_watcher( "murfey_db_credentials": machine_config.murfey_db_credentials, "visit": visit, "crypto_key": "", + "default_model": machine_config.default_model, } async with aiohttp.ClientSession() as session: async with session.post( f"{machine_config.instrument_server_url}/sessions/{session_id}/multigrid_watcher", json={ - "source": secure_filename(str(watcher_spec.source / visit)), + "source": str(secure_path(watcher_spec.source / visit)), "visit": visit, "configuration": _config, "label": label, From 2869a6215f79e2984c8deb6d6250419e47d2b6e5 Mon Sep 17 00:00:00 2001 From: Dan Hatton Date: Tue, 17 Sep 2024 20:24:41 +0100 Subject: [PATCH 2/4] Turn transfer on --- src/murfey/instrument_server/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/murfey/instrument_server/api.py b/src/murfey/instrument_server/api.py index ea275cf5e..4e2f59a4c 100644 --- a/src/murfey/instrument_server/api.py +++ b/src/murfey/instrument_server/api.py @@ -118,7 +118,7 @@ def start_multigrid_watcher(session_id: int, watcher_spec: MultigridWatcherSpec) session_id, murfey_url=_get_murfey_url(), demo=True, - do_transfer=False, + do_transfer=True, processing_enabled=not watcher_spec.skip_existing_processing, _machine_config=watcher_spec.configuration.dict(), token=tokens.get("token", ""), From 5441e40bb6a5ed534c57d07020043ac20a372f04 Mon Sep 17 00:00:00 2001 From: Dan Hatton Date: Tue, 17 Sep 2024 20:51:31 +0100 Subject: [PATCH 3/4] Correct gain intermediate path with tag --- src/murfey/server/gain.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/murfey/server/gain.py b/src/murfey/server/gain.py index f026be9a2..fe6e7119f 100644 --- a/src/murfey/server/gain.py +++ b/src/murfey/server/gain.py @@ -15,8 +15,12 @@ class Camera(Enum): FALCON = 3 -def _sanitise(gain_path: Path) -> Path: - dest = gain_path.parent / "gain" / gain_path.name.replace(" ", "_") +def _sanitise(gain_path: Path, tag: str = "") -> Path: + dest = ( + gain_path.parent + / (f"gain_{tag}" if tag else "gain") + / gain_path.name.replace(" ", "_") + ) dest.write_bytes(gain_path.read_bytes()) return dest From 620906fae4b008c438c4bd3c586a3b4eea7548cd Mon Sep 17 00:00:00 2001 From: Dan Hatton Date: Tue, 17 Sep 2024 21:39:44 +0100 Subject: [PATCH 4/4] Need to convert websocket message to bytes --- src/murfey/client/multigrid_control.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/murfey/client/multigrid_control.py b/src/murfey/client/multigrid_control.py index 7ae9dd4c3..052cc5a02 100644 --- a/src/murfey/client/multigrid_control.py +++ b/src/murfey/client/multigrid_control.py @@ -1,3 +1,4 @@ +import json import logging import threading from dataclasses import dataclass, field @@ -128,7 +129,7 @@ def _start_rsyncer_multigrid( tag=tag, limited=limited, ) - self.ws.send({"message": "refresh"}) + self.ws.send(json.dumps({"message": "refresh"})) def _rsyncer_stopped(self, source: Path, explicit_stop: bool = False): if explicit_stop: