Skip to content

Commit 09339a3

Browse files
committed
feat: more robust create_chunk_restriction logic
1 parent 53f1065 commit 09339a3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

aeon/dj_pipeline/acquisition.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,9 @@ def create_chunk_restriction(experiment_name, start_time, end_time):
713713
end_restriction = f'"{end_time}" BETWEEN chunk_start AND chunk_end'
714714
start_query = Chunk & exp_key & start_restriction
715715
end_query = Chunk & exp_key & end_restriction
716+
if not start_query:
717+
# No chunk contains the start time, so we need to find the first chunk that ends after the start time
718+
start_query = Chunk & exp_key & f'chunk_start BETWEEN "{start_time}" AND "{end_time}"'
716719
if not end_query:
717720
# No chunk contains the end time, so we need to find the last chunk that starts before the end time
718721
end_query = Chunk & exp_key & f'chunk_end BETWEEN "{start_time}" AND "{end_time}"'

0 commit comments

Comments
 (0)