1- import contextlib
21import os
32import platform
43import re
2120from cubed .diagnostics .tqdm import TqdmProgressBar
2221from cubed .primitive .blockwise import apply_blockwise
2322from cubed .runtime .create import create_executor
23+ from cubed .storage .backend import backend_storage_name
2424from cubed .tests .utils import (
2525 ALL_EXECUTORS ,
2626 MAIN_EXECUTORS ,
@@ -190,6 +190,10 @@ def func(a):
190190 b .compute (executor = executor , callbacks = [mem_warn ])
191191
192192
193+ @pytest .mark .skipif (
194+ backend_storage_name () == "tensorstore" ,
195+ reason = "tensorstore does not support resume" ,
196+ )
193197def test_resume (spec , executor ):
194198 if executor .name == "beam" :
195199 pytest .skip (f"{ executor .name } executor does not support resume" )
@@ -207,24 +211,17 @@ def test_resume(spec, executor):
207211 num_created_arrays = 1 # c
208212 assert task_counter .value == num_created_arrays + 4
209213
210- if not hasattr (c .zarray , "nchunks_initialized" ):
211- # We expect resume to fail if there is no 'nchunks_initialized' property on the Zarr array
212- cm = pytest .raises (NotImplementedError )
213- else :
214- cm = contextlib .nullcontext ()
215-
216- with cm :
217- # since c has already been computed, when computing d only 4 tasks are run, instead of 8
218- task_counter = TaskCounter ()
219- d .compute (
220- executor = executor ,
221- callbacks = [task_counter ],
222- optimize_graph = False ,
223- resume = True ,
224- )
225- # the create arrays tasks are run again, even though they exist
226- num_created_arrays = 2 # c, d
227- assert task_counter .value == num_created_arrays + 4
214+ # since c has already been computed, when computing d only 4 tasks are run, instead of 8
215+ task_counter = TaskCounter ()
216+ d .compute (
217+ executor = executor ,
218+ callbacks = [task_counter ],
219+ optimize_graph = False ,
220+ resume = True ,
221+ )
222+ # the create arrays tasks are run again, even though they exist
223+ num_created_arrays = 2 # c, d
224+ assert task_counter .value == num_created_arrays + 4
228225
229226
230227@pytest .mark .parametrize ("compute_arrays_in_parallel" , [True , False ])
0 commit comments