66
77from  cubed .runtime .create  import  create_executor 
88from  cubed .runtime .types  import  Executor 
9+ from  cubed .types  import  T_Store 
910from  cubed .utils  import  convert_to_bytes 
1011
1112
@@ -15,6 +16,8 @@ class Spec:
1516    def  __init__ (
1617        self ,
1718        work_dir : Union [str , None ] =  None ,
19+         * ,
20+         intermediate_store : Union [T_Store , None ] =  None ,
1821        allowed_mem : Union [int , str , None ] =  None ,
1922        reserved_mem : Union [int , str , None ] =  0 ,
2023        executor : Union [Executor , None ] =  None ,
@@ -30,6 +33,8 @@ def __init__(
3033        ---------- 
3134        work_dir : str or None 
3235            The directory path (specified as an fsspec or obstore URL) used for storing intermediate data. 
36+         intermediate_store : store, optional 
37+             The Zarr store for intermediate data. Takes precedence over ``work_dir``. 
3338        allowed_mem : int or str, optional 
3439            The total memory available to a worker for running a task, in bytes. 
3540
@@ -65,6 +70,7 @@ def __init__(
6570        self ._executor_options  =  executor_options 
6671        self ._storage_options  =  storage_options 
6772        self ._zarr_compressor  =  zarr_compressor 
73+         self ._intermediate_store  =  intermediate_store 
6874
6975    @property  
7076    def  work_dir (self ) ->  Optional [str ]:
@@ -118,16 +124,22 @@ def zarr_compressor(self) -> Union[dict, str, None]:
118124        """The compressor used by Zarr for intermediate data.""" 
119125        return  self ._zarr_compressor 
120126
127+     @property  
128+     def  intermediate_store (self ) ->  Union [dict , str , None ]:
129+         """The Zarr store for intermediate data. Takes precedence over ``work_dir``.""" 
130+         return  self ._intermediate_store 
131+ 
121132    def  __repr__ (self ) ->  str :
122133        return  (
123-             f"cubed.Spec(work_dir={ self ._work_dir } { self ._allowed_mem }  
134+             f"cubed.Spec(work_dir={ self ._work_dir } intermediate_store= { self . _intermediate_store } ,  allowed_mem={ self ._allowed_mem }  
124135            f"reserved_mem={ self ._reserved_mem } { self ._executor } { self ._storage_options } { self ._zarr_compressor }  
125136        )
126137
127138    def  __eq__ (self , other ):
128139        if  isinstance (other , Spec ):
129140            return  (
130141                self .work_dir  ==  other .work_dir 
142+                 and  self .intermediate_store  ==  other .intermediate_store 
131143                and  self .allowed_mem  ==  other .allowed_mem 
132144                and  self .reserved_mem  ==  other .reserved_mem 
133145                and  self .executor  ==  other .executor 
0 commit comments