Skip to content

Commit df1497d

Browse files
Changes needed to make the old gui work with the recent updates (#368)
1 parent ec4286f commit df1497d

6 files changed

Lines changed: 33 additions & 10 deletions

File tree

src/murfey/client/contexts/clem.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def _file_transferred_to(
2727
Returns the Path of the transferred file on the DLS file system.
2828
"""
2929
machine_config = get_machine_config(
30-
str(environment.url.geturl()), demo=environment.demo
30+
str(environment.url.geturl()),
31+
instrument_name=environment.instrument_name,
32+
demo=environment.demo,
3133
)
3234
# rsync basepath and modules are set in the microscope's configuration YAML file
3335
return (

src/murfey/client/contexts/spa_metadata.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ def _atlas_destination(
1919
environment: MurfeyInstanceEnvironment, source: Path, file_path: Path
2020
) -> Path:
2121
machine_config = get_machine_config(
22-
str(environment.url.geturl()), demo=environment.demo
22+
str(environment.url.geturl()),
23+
instrument_name=environment.instrument_name,
24+
demo=environment.demo,
2325
)
2426
if environment.visit in environment.default_destinations[source]:
2527
return (

src/murfey/client/tui/app.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ def _launch_multigrid_watcher(
129129
):
130130
log.info(f"Launching multigrid watcher for source {source}")
131131
machine_config = get_machine_config(
132-
str(self._environment.url.geturl()), demo=self._environment.demo
132+
str(self._environment.url.geturl()),
133+
instrument_name=self._environment.instrument_name,
134+
demo=self._environment.demo,
133135
)
134136
self._multigrid_watcher = MultigridDirWatcher(
135137
source,
@@ -154,6 +156,7 @@ def _start_rsyncer_multigrid(
154156
remove_files: bool = False,
155157
analyse: bool = True,
156158
limited: bool = False,
159+
**kwargs,
157160
):
158161
log.info(f"starting multigrid rsyncer: {source}")
159162
destination_overrides = destination_overrides or {}
@@ -257,7 +260,7 @@ def rsync_result(update: RSyncerUpdate):
257260
),
258261
secondary=True,
259262
)
260-
url = f"{str(self._url.geturl())}/visits/{str(self._visit)}/rsyncer"
263+
url = f"{str(self._url.geturl())}/sessions/{str(self._environment.murfey_session)}/rsyncer"
261264
rsyncer_data = {
262265
"source": str(source),
263266
"destination": destination,
@@ -686,7 +689,9 @@ def on_log_book_log(self, message):
686689

687690
async def reset(self):
688691
machine_config = get_machine_config(
689-
str(self._environment.url.geturl()), demo=self._environment.demo
692+
str(self._environment.url.geturl()),
693+
instrument_name=self._environment.instrument_name,
694+
demo=self._environment.demo,
690695
)
691696
if self.rsync_processes and machine_config.get("allow_removal"):
692697
sources = "\n".join(str(k) for k in self.rsync_processes.keys())
@@ -739,7 +744,9 @@ def clean_up_quit(self) -> None:
739744

740745
async def action_clear(self) -> None:
741746
machine_config = get_machine_config(
742-
str(self._environment.url.geturl()), demo=self._environment.demo
747+
str(self._environment.url.geturl()),
748+
instrument_name=self._environment.instrument_name,
749+
demo=self._environment.demo,
743750
)
744751
if self.rsync_processes and machine_config.get("allow_removal"):
745752
sources = "\n".join(str(k) for k in self.rsync_processes.keys())

src/murfey/server/api/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,16 @@ def register_client_to_visit(visit_name: str, client_info: ClientInfo, db=murfey
208208
client_env = db.exec(
209209
select(ClientEnvironment).where(ClientEnvironment.client_id == client_info.id)
210210
).one()
211+
session = db.exec(select(Session).where(Session.id == client_env.session_id)).one()
211212
if client_env:
212213
client_env.visit = visit_name
213214
db.add(client_env)
214215
db.commit()
215-
db.close()
216+
if session:
217+
session.visit = visit_name
218+
db.add(session)
219+
db.commit()
220+
db.close()
216221
return client_info
217222

218223

@@ -1127,7 +1132,9 @@ async def request_spa_preprocessing(
11271132
"particle_diameter": proc_params["particle_diameter"] or 0,
11281133
"fm_int_file": proc_file.eer_fractionation_file,
11291134
"do_icebreaker_jobs": default_spa_parameters.do_icebreaker_jobs,
1130-
"cryolo_model_weights": str(_cryolo_model_path(visit_name)),
1135+
"cryolo_model_weights": str(
1136+
_cryolo_model_path(visit_name, instrument_name)
1137+
),
11311138
},
11321139
}
11331140
# log.info(f"Sending Zocalo message {zocalo_message}")

src/murfey/util/__init__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,12 @@ def capture_post(url: str, json: dict | list = {}) -> requests.Response | None:
9797
f"{response.status_code}. The reason given was {response.reason}"
9898
)
9999
split_url = urlparse(url)
100-
failure_url = urlunparse(split_url._replace(path="/failed_client_post"))
100+
client_config = read_config()
101+
failure_url = urlunparse(
102+
split_url._replace(
103+
path=f"/instruments/{client_config['Murfey']['instrument_name']}/failed_client_post"
104+
)
105+
)
101106
try:
102107
resend_response = requests.post(
103108
failure_url, json={"url": url, "data": json}

tests/client/test_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_tomography_context_initialisation_for_serialem(tmp_path):
245245
def test_setting_tilt_series_size_and_completion_from_mdoc_parsing(
246246
mock_post, mock_get, tmp_path
247247
):
248-
mock_post.post().status_code = 200
248+
mock_post().status_code = 200
249249

250250
env = MurfeyInstanceEnvironment(
251251
url=urlparse("http://localhost:8000"),

0 commit comments

Comments
 (0)