Skip to content

Commit 5122c38

Browse files
committed
Merge branch 'main' into dcg-source-fix
2 parents fdc90a8 + ed26545 commit 5122c38

34 files changed

Lines changed: 284 additions & 1349 deletions

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ name: Build and test
33
on: [push, pull_request]
44

55
env:
6-
ISPYB_DATABASE_SCHEMA: 4.8.0
6+
ISPYB_DATABASE_SCHEMA: 4.11.0
77
# Installs from GitHub
88
# Versions: https://github.com/DiamondLightSource/ispyb-database/tags
99
# Previous version(s):
10+
# 4.8.0
1011
# 4.2.1 # released 2024-08-19
1112
# 4.1.0 # released 2024-03-26
1213

src/murfey/client/analyser.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ def __init__(
6565
str(environment.url.geturl()),
6666
self._token,
6767
instrument_name=environment.instrument_name,
68-
demo=environment.demo,
6968
)
7069
if environment
7170
else {}
@@ -398,7 +397,9 @@ def _xml_file(self, data_file: Path) -> Path:
398397
base_dir, mid_dir = find_longest_data_directory(data_file, data_directories)
399398
if not base_dir:
400399
return data_file.with_suffix(".xml")
401-
return base_dir / self._environment.visit / mid_dir / file_name
400+
# Add the visit directory to the file path and return it
401+
# The file is moved from a location where the visit name is not part of its path
402+
return base_dir / self._environment.visit / (mid_dir or "") / file_name
402403

403404
def enqueue(self, rsyncer: RSyncerUpdate):
404405
if not self._stopping and rsyncer.outcome == TransferResult.SUCCESS:

src/murfey/client/context.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def _atlas_destination(
2020
str(environment.url.geturl()),
2121
token,
2222
instrument_name=environment.instrument_name,
23-
demo=environment.demo,
2423
)
2524
for i, destination_part in enumerate(
2625
Path(environment.default_destinations[source]).parts

src/murfey/client/contexts/clem.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def _file_transferred_to(
2828
str(environment.url.geturl()),
2929
token,
3030
instrument_name=environment.instrument_name,
31-
demo=environment.demo,
3231
)
3332

3433
# Construct destination path

src/murfey/client/contexts/spa.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import logging
44
from itertools import count
55
from pathlib import Path
6-
from typing import Any, Dict, List, Optional, OrderedDict, Tuple
6+
from typing import Any, Optional, OrderedDict
77

88
import xmltodict
99

@@ -33,7 +33,6 @@ def _file_transferred_to(
3333
str(environment.url.geturl()),
3434
token,
3535
instrument_name=environment.instrument_name,
36-
demo=environment.demo,
3736
)
3837
if environment.visit in environment.default_destinations[source]:
3938
return (
@@ -50,10 +49,10 @@ def _file_transferred_to(
5049

5150

5251
def _grid_square_metadata_file(
53-
f: Path, data_directories: List[Path], visit: str, grid_square: int
52+
f: Path, data_directories: list[Path], visit: str, grid_square: int
5453
) -> Path:
5554
base_dir, mid_dir = find_longest_data_directory(f, data_directories)
56-
if not base_dir:
55+
if not base_dir or not mid_dir:
5756
raise ValueError(f"Could not determine grid square metadata path for {f}")
5857
metadata_file = (
5958
base_dir
@@ -113,7 +112,7 @@ def __init__(self, acquisition_software: str, basepath: Path, token: str):
113112
super().__init__("SPA", acquisition_software, token)
114113
self._basepath = basepath
115114
self._processing_job_stash: dict = {}
116-
self._foil_holes: Dict[int, List[int]] = {}
115+
self._foil_holes: dict[int, list[int]] = {}
117116

118117
def gather_metadata(
119118
self, metadata_file: Path, environment: MurfeyInstanceEnvironment | None = None
@@ -287,7 +286,7 @@ def _position_analysis(
287286
and self._foil_holes.get(grid_square) is None
288287
):
289288
self._foil_holes[grid_square] = []
290-
gs_pix_position: Tuple[
289+
gs_pix_position: tuple[
291290
Optional[int],
292291
Optional[int],
293292
Optional[float],
@@ -453,7 +452,6 @@ def post_transfer(
453452
str(environment.url.geturl()),
454453
self._token,
455454
instrument_name=environment.instrument_name,
456-
demo=environment.demo,
457455
)
458456
else:
459457
machine_config = {}
@@ -586,7 +584,7 @@ def _register_processing_job(
586584
self,
587585
tag: str,
588586
environment: MurfeyInstanceEnvironment,
589-
parameters: Dict[str, Any] | None = None,
587+
parameters: dict[str, Any] | None = None,
590588
):
591589
return
592590

src/murfey/client/contexts/tomo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,6 @@ def _file_transferred_to(
191191
str(environment.url.geturl()),
192192
self._token,
193193
instrument_name=environment.instrument_name,
194-
demo=environment.demo,
195194
)
196195
if environment.visit in environment.default_destinations[source]:
197196
return (
@@ -465,7 +464,6 @@ def post_transfer(
465464
str(environment.url.geturl()),
466465
self._token,
467466
instrument_name=environment.instrument_name,
468-
demo=environment.demo,
469467
)
470468
else:
471469
machine_config = {}

src/murfey/client/destinations.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@
1515

1616
def find_longest_data_directory(
1717
match_path: Path, data_directories: list[str] | list[Path]
18-
):
18+
) -> tuple[Path | None, Path | None]:
1919
"""
2020
Determine the longest path in the data_directories list
2121
which the match path is relative to
2222
"""
2323
base_dir: Path | None = None
2424
mid_dir: Path | None = None
2525
for dd in data_directories:
26-
dd_base = str(Path(dd).absolute())
27-
if str(match_path).startswith(str(dd)) and len(dd_base) > len(str(base_dir)):
28-
base_dir = Path(dd_base)
26+
dd_base = Path(dd).absolute()
27+
if match_path.absolute().is_relative_to(dd_base) and len(dd_base.parts) > (
28+
len(base_dir.parts) if base_dir else 0
29+
):
30+
base_dir = dd_base
2931
mid_dir = match_path.absolute().relative_to(Path(base_dir)).parent
3032
return base_dir, mid_dir
3133

src/murfey/client/instance_environment.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class MurfeyInstanceEnvironment(BaseModel):
4040
default_destinations: Dict[Path, str] = {}
4141
destination_registry: Dict[str, str] = {}
4242
watchers: Dict[Path, DirWatcher] = {}
43-
demo: bool = False
4443
movies: Dict[Path, MovieTracker] = {}
4544
movie_tilt_pair: Dict[Path, str] = {}
4645
tilt_angles: Dict[str, List[List[str]]] = {}

src/murfey/client/multigrid_control.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ class MultigridController:
3737
murfey_url: str = "http://localhost:8000"
3838
rsync_url: str = ""
3939
rsync_module: str = "data"
40-
demo: bool = False
4140
finalising: bool = False
4241
dormant: bool = False
4342
multigrid_watcher_active: bool = True
@@ -68,7 +67,6 @@ def __post_init__(self):
6867
client_id=0,
6968
murfey_session=self.session_id,
7069
software_versions=machine_data.get("software_versions", {}),
71-
demo=self.demo,
7270
visit=self.visit,
7371
dose_per_frame=self.data_collection_parameters.get("dose_per_frame"),
7472
gain_ref=self.data_collection_parameters.get("gain_ref"),
@@ -80,7 +78,6 @@ def __post_init__(self):
8078
str(self._environment.url.geturl()),
8179
self.token,
8280
instrument_name=self._environment.instrument_name,
83-
demo=self._environment.demo,
8481
)
8582
self._data_suffixes = (".mrc", ".tiff", ".tif", ".eer")
8683
self._data_substrings = [
@@ -430,7 +427,7 @@ def rsync_result(update: RSyncerUpdate):
430427
"source": str(source),
431428
"destination": destination,
432429
"session_id": self.session_id,
433-
"transferring": self.do_transfer or self._environment.demo,
430+
"transferring": self.do_transfer,
434431
"tag": tag,
435432
}
436433
capture_post(

src/murfey/instrument_server/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ def setup_multigrid_watcher(
173173
watcher_spec.instrument_name,
174174
session_id,
175175
murfey_url=_get_murfey_url(),
176-
demo=True,
177176
do_transfer=True,
178177
processing_enabled=not watcher_spec.skip_existing_processing,
179178
_machine_config=machine_config,

0 commit comments

Comments
 (0)