Skip to content

Commit 3b35bcd

Browse files
committed
No more skip existing processing and first loop logic
1 parent e3fc2aa commit 3b35bcd

5 files changed

Lines changed: 4 additions & 26 deletions

File tree

src/murfey/client/watchdir_multigrid.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ def __init__(
1717
self,
1818
path: str | os.PathLike,
1919
machine_config: dict,
20-
skip_existing_processing: bool = False,
2120
):
2221
super().__init__()
2322
self._basepath = Path(path)
@@ -30,7 +29,6 @@ def __init__(
3029
)
3130
# Toggleable settings
3231
self._analyse = True
33-
self._skip_existing_processing = skip_existing_processing
3432
self._stopping = False
3533

3634
def start(self):
@@ -61,21 +59,14 @@ def _handle_metadata(self, directory: Path, extra_directory: str):
6159
)
6260
self._seen_dirs.append(directory)
6361

64-
def _handle_fractions(self, directory: Path, first_loop: bool):
62+
def _handle_fractions(self, directory: Path):
6563
processing_started = False
6664
for d02 in directory.glob("Images-Disc*"):
6765
if d02 not in self._seen_dirs:
68-
# If 'skip_existing_processing' is set, do not process for
69-
# any data directories found on the first loop.
70-
# This allows you to avoid triggering processing again if Murfey is restarted
7166
self.notify(
7267
d02,
7368
remove_files=True,
74-
analyse=(
75-
not (first_loop and self._skip_existing_processing)
76-
if self._analyse
77-
else False
78-
),
69+
analyse=self._analyse,
7970
tag="fractions",
8071
)
8172
self._seen_dirs.append(d02)
@@ -88,17 +79,12 @@ def _handle_fractions(self, directory: Path, first_loop: bool):
8879
):
8980
self.notify(
9081
directory,
91-
analyse=(
92-
not (first_loop and self._skip_existing_processing)
93-
if self._analyse
94-
else False
95-
),
82+
analyse=self._analyse,
9683
tag="fractions",
9784
)
9885
self._seen_dirs.append(directory)
9986

10087
def _process(self):
101-
first_loop = True
10288
while not self._stopping:
10389
for d in self._basepath.glob("*"):
10490
if d.name in self._machine_config["create_directories"]:
@@ -133,18 +119,14 @@ def _process(self):
133119
self._handle_fractions(
134120
sample.parent.parent.parent
135121
/ f"{sample.parent.name}_{sample.name}",
136-
first_loop,
137122
)
138123

139124
else:
140125
if d.is_dir() and d not in self._seen_dirs:
141126
self._handle_metadata(
142127
d, extra_directory=f"metadata_{d.name}"
143128
)
144-
self._handle_fractions(d.parent.parent / d.name, first_loop)
145-
146-
if first_loop:
147-
first_loop = False
129+
self._handle_fractions(d.parent.parent / d.name)
148130
time.sleep(15)
149131

150132
self.notify(final=True)

src/murfey/instrument_server/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ def setup_multigrid_watcher(
189189
watchers[session_id] = MultigridDirWatcher(
190190
watcher_spec.source,
191191
machine_config,
192-
skip_existing_processing=watcher_spec.skip_existing_processing,
193192
)
194193
watchers[session_id].subscribe(
195194
partial(

src/murfey/server/api/instrument.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ async def setup_multigrid_watcher(
154154
"visit": visit,
155155
"label": visit,
156156
"instrument_name": instrument_name,
157-
"skip_existing_processing": watcher_spec.skip_existing_processing,
158157
"destination_overrides": {
159158
str(k): v for k, v in watcher_spec.destination_overrides.items()
160159
},

src/murfey/util/instrument_models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class MultigridWatcherSpec(BaseModel):
1010
label: str
1111
visit: str
1212
instrument_name: str
13-
skip_existing_processing: bool = False
1413
destination_overrides: Dict[Path, str] = {}
1514
rsync_restarts: List[str] = []
1615
visit_end_time: Optional[datetime] = None

src/murfey/util/models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ class BatchPositionParameters(BaseModel):
203203

204204
class MultigridWatcherSetup(BaseModel):
205205
source: Path
206-
skip_existing_processing: bool = False
207206
destination_overrides: Dict[Path, str] = {}
208207
rsync_restarts: List[str] = []
209208

0 commit comments

Comments
 (0)