@@ -27,7 +27,7 @@ def get_session(username: str, password: str, cacert: typing.Optional[str]) -> r
27
27
28
28
def reduce_chunk (session , server , source , bucket , object ,
29
29
offset , size , compression , filters , missing , dtype , shape ,
30
- order , chunk_selection , operation ):
30
+ order , chunk_selection , operation , storage_type = None ):
31
31
"""Perform a reduction on a chunk using Reductionist.
32
32
33
33
:param server: Reductionist server URL
@@ -50,12 +50,14 @@ def reduce_chunk(session, server, source, bucket, object,
50
50
this defines the part of the chunk which is to be
51
51
obtained or operated upon.
52
52
:param operation: name of operation to perform
53
+ :param storage_type: optional testing flag to allow HTTPS reduction
53
54
:returns: the reduced data as a numpy array or scalar
54
55
:raises ReductionistError: if the request to Reductionist fails
55
56
"""
56
57
57
58
request_data = build_request_data (source , bucket , object , offset , size , compression ,
58
- filters , missing , dtype , shape , order , chunk_selection )
59
+ filters , missing , dtype , shape , order , chunk_selection ,
60
+ storage_type = storage_type )
59
61
if DEBUG :
60
62
print (f"Reductionist request data dictionary: { request_data } " )
61
63
api_operation = "sum" if operation == "mean" else operation or "select"
@@ -135,7 +137,7 @@ def encode_missing(missing):
135
137
136
138
def build_request_data (source : str , bucket : str , object : str , offset : int ,
137
139
size : int , compression , filters , missing , dtype , shape ,
138
- order , selection ) -> dict :
140
+ order , selection , storage_type = None ) -> dict :
139
141
"""Build request data for Reductionist API."""
140
142
request_data = {
141
143
'source' : source ,
@@ -146,6 +148,7 @@ def build_request_data(source: str, bucket: str, object: str, offset: int,
146
148
'offset' : int (offset ),
147
149
'size' : int (size ),
148
150
'order' : order ,
151
+ 'storage_type' : storage_type ,
149
152
}
150
153
if shape :
151
154
request_data ["shape" ] = shape
0 commit comments