File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66from cubed import config
77from cubed .backend_array_api import namespace as nxp
88from cubed .backend_array_api import numpy_array_to_backend_array
9+ from cubed .runtime .create import create_executor
910from cubed .runtime .types import Callback , Executor
1011from cubed .spec import Spec , spec_from_config
1112from cubed .storage .zarr import open_if_lazy_zarr_array
@@ -296,11 +297,9 @@ def compute(
296297 compile_function = compile_function ,
297298 )
298299 if executor is None :
299- executor = arrays [ 0 ]. spec .executor
300+ executor = spec .executor
300301 if executor is None :
301- from cubed .runtime .executors .local import ThreadsExecutor
302-
303- executor = ThreadsExecutor ()
302+ executor = create_executor ("threads" , spec .executor_options )
304303
305304 # combine any callbacks specified as args with any active callbacks from the context manager
306305 if callbacks is None and len (Callback .active ) == 0 :
Original file line number Diff line number Diff line change 1+ import os
12import platform
23import random
34from functools import partial
@@ -504,7 +505,11 @@ def test_default_spec_config_override():
504505 from cubed import config
505506
506507 with config .set (
507- {"spec.allowed_mem" : "4GB" , "spec.executor_name" : "single-threaded" }
508+ {
509+ "spec.allowed_mem" : "4GB" ,
510+ # need to decrease max workers proportionately
511+ "spec.executor_options.max_workers" : os .cpu_count () // 2 ,
512+ }
508513 ):
509514 a = xp .ones ((20000 , 10000 ), chunks = (10000 , 10000 ))
510515 b = xp .negative (a )
You can’t perform that action at this time.
0 commit comments