Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions activestorage/active.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,20 +515,19 @@ def _from_storage(self, ds, indexer, chunks, out_shape, out_dtype,
if self.interface_type == "s3" and self._version == 2:
if self.storage_options is not None:
key, secret = None, None
if self.storage_options.get("anon", None) is True:
print("Reductionist session for Anon S3 bucket.")
session = reductionist.get_session(
None, None, S3_ACTIVE_STORAGE_CACERT)
if "key" in self.storage_options:
key = self.storage_options["key"]
if "secret" in self.storage_options:
secret = self.storage_options["secret"]
if key and secret:
session = reductionist.get_session(
key, secret, S3_ACTIVE_STORAGE_CACERT)
elif self.storage_options.get("anon", None) is True:
print("Reductionist session for Anon S3 bucket.")
key = None
secret = None
else:
session = reductionist.get_session(
S3_ACCESS_KEY, S3_SECRET_KEY, S3_ACTIVE_STORAGE_CACERT)
key = S3_ACCESS_KEY
secret = S3_SECRET_KEY
session = reductionist.get_session(
key, secret, S3_ACTIVE_STORAGE_CACERT)
else:
session = reductionist.get_session(S3_ACCESS_KEY,
S3_SECRET_KEY,
Expand Down
6 changes: 1 addition & 5 deletions activestorage/reductionist.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ def get_session(username: str, password: str,
:returns: a client session object.
"""
session = requests.Session()
# TODO Stack-HPC
# we need to allow Anon buckets. though this
# will break connection to data server
# if username is None and password is None:
# return session
session.auth = (username, password)
session.verify = cacert or False
return session
Expand Down Expand Up @@ -91,6 +86,7 @@ def reduce_chunk(session,
print(f"Reductionist request data dictionary: {request_data}")
api_operation = "sum" if operation == "mean" else operation or "select"
url = f'{server}/v2/{api_operation}/'
print("Reductionist Session auth:", session.auth)
response = request(session, url, request_data)

if response.ok:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_real_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def test_anon_s3():
},
active_storage_url=active_storage_url)
active._version = 2
with pytest.raises(ReductionistError):
result = active.min()[:]
assert result == 197.69595

result = active.min()[:]
assert result == 197.69595


def test_s3_small_file():
Expand Down
Loading