@@ -21,6 +21,7 @@ def __init__(
21
21
executor_name : Optional [str ] = None ,
22
22
executor_options : Optional [dict ] = None ,
23
23
storage_options : Union [dict , None ] = None ,
24
+ zarr_compressor : Union [dict , str , None ] = "default" ,
24
25
):
25
26
"""
26
27
Specify resources available to run a computation.
@@ -42,6 +43,13 @@ def __init__(
42
43
The default executor for running computations.
43
44
storage_options : dict, optional
44
45
Storage options to be passed to fsspec.
46
+ zarr_compressor : dict or str, optional
47
+ The compressor used by Zarr for intermediate data.
48
+
49
+ If not specified, or set to ``"default"``, Zarr will use the default Blosc compressor.
50
+ If set to ``None``, compression is disabled, which can be a good option when using local storage.
51
+ Use a dictionary to configure arbitrary compression using Numcodecs. The following example specifies
52
+ Blosc compression: ``zarr_compressor={"id": "blosc", "cname": "lz4", "clevel": 2, "shuffle": -1}``.
45
53
"""
46
54
47
55
self ._work_dir = work_dir
@@ -61,6 +69,7 @@ def __init__(
61
69
self ._executor = None
62
70
63
71
self ._storage_options = storage_options
72
+ self ._zarr_compressor = zarr_compressor
64
73
65
74
@property
66
75
def work_dir (self ) -> Optional [str ]:
@@ -97,10 +106,15 @@ def storage_options(self) -> Optional[dict]:
97
106
"""Storage options to be passed to fsspec."""
98
107
return self ._storage_options
99
108
109
+ @property
110
+ def zarr_compressor (self ) -> Union [dict , str , None ]:
111
+ """The compressor used by Zarr for intermediate data."""
112
+ return self ._zarr_compressor
113
+
100
114
def __repr__ (self ) -> str :
101
115
return (
102
116
f"cubed.Spec(work_dir={ self ._work_dir } , allowed_mem={ self ._allowed_mem } , "
103
- f"reserved_mem={ self ._reserved_mem } , executor={ self ._executor } , storage_options={ self ._storage_options } )"
117
+ f"reserved_mem={ self ._reserved_mem } , executor={ self ._executor } , storage_options={ self ._storage_options } , zarr_compressor= { self . _zarr_compressor } )"
104
118
)
105
119
106
120
def __eq__ (self , other ):
@@ -111,6 +125,7 @@ def __eq__(self, other):
111
125
and self .reserved_mem == other .reserved_mem
112
126
and self .executor == other .executor
113
127
and self .storage_options == other .storage_options
128
+ and self .zarr_compressor == other .zarr_compressor
114
129
)
115
130
else :
116
131
return False
0 commit comments