Skip to content

Commit a9ac5d9

Browse files
authored
Skip continuity check when using ExhaustPlugin (#966)
1 parent 9a2a9ea commit a9ac5d9

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

strax/chunk.py

+15-12
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ def last_subrun(self):
150150
_subrun = self._get_subrun(-1)
151151
return _subrun
152152

153+
@property
154+
def promised_continuity(self):
155+
if not self.is_superrun:
156+
return True
157+
# TODO: be more clever on this?
158+
# Subruns start and end does not match with chunk start and end.
159+
# This might mean that you are using ExhaustPlugin.
160+
return self.first_subrun["start"] == self.start and self.last_subrun["end"] == self.end
161+
153162
def _get_subrun(self, index):
154163
"""Returns subrun according to position in chunk."""
155164
run_id = list(self.subruns.keys())[index]
@@ -220,16 +229,11 @@ def split(self, t: ty.Union[int, None], allow_early_split=False):
220229
target_size_mb=self.target_size_mb,
221230
)
222231

223-
if self.is_superrun and (
224-
self.first_subrun["start"] != self.start or self.last_subrun["end"] != self.end
225-
):
226-
# TODO: be more clever on this?
227-
# Subruns start and end does not match with chunk start and end.
228-
# This might mean that you are using ExhaustPlugin.
229-
# So the split will not update the subruns or superrun.
230-
subruns_first_chunk = subruns_second_chunk = self.subruns
231-
else:
232+
if self.promised_continuity:
232233
subruns_first_chunk, subruns_second_chunk = _split_runs_in_chunk(self.subruns, t)
234+
else:
235+
# The split will not update the subruns or superrun.
236+
subruns_first_chunk = subruns_second_chunk = self.subruns
233237

234238
superrun_first_chunk, superrun_second_chunk = _split_runs_in_chunk(self.superrun, t)
235239
# If the superrun is split and the fragment cover only one run,
@@ -382,13 +386,12 @@ def continuity_check(chunk_iter):
382386
last_subrun = {"run_id": None}
383387

384388
if chunk.is_superrun:
385-
_subrun = chunk.first_subrun
386-
if _subrun["run_id"] != last_subrun["run_id"]:
389+
if chunk.first_subrun["run_id"] != last_subrun["run_id"]:
387390
last_end = None
388391
else:
389392
last_end = last_subrun["end"]
390393

391-
if last_end is not None:
394+
if last_end is not None and chunk.promised_continuity:
392395
if chunk.start != last_end:
393396
raise ValueError(
394397
f"Data is not continuous. Chunk {chunk} should have started at {last_end}"

0 commit comments

Comments
 (0)