@@ -150,6 +150,15 @@ def last_subrun(self):
150
150
_subrun = self ._get_subrun (- 1 )
151
151
return _subrun
152
152
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
+
153
162
def _get_subrun (self , index ):
154
163
"""Returns subrun according to position in chunk."""
155
164
run_id = list (self .subruns .keys ())[index ]
@@ -220,16 +229,11 @@ def split(self, t: ty.Union[int, None], allow_early_split=False):
220
229
target_size_mb = self .target_size_mb ,
221
230
)
222
231
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 :
232
233
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
233
237
234
238
superrun_first_chunk , superrun_second_chunk = _split_runs_in_chunk (self .superrun , t )
235
239
# If the superrun is split and the fragment cover only one run,
@@ -382,13 +386,12 @@ def continuity_check(chunk_iter):
382
386
last_subrun = {"run_id" : None }
383
387
384
388
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" ]:
387
390
last_end = None
388
391
else :
389
392
last_end = last_subrun ["end" ]
390
393
391
- if last_end is not None :
394
+ if last_end is not None and chunk . promised_continuity :
392
395
if chunk .start != last_end :
393
396
raise ValueError (
394
397
f"Data is not continuous. Chunk { chunk } should have started at { last_end } "
0 commit comments