Skip to content

Commit

Permalink
turn off some printing to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriupredoi committed Mar 18, 2024
1 parent d064319 commit 730f6ec
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions activestorage/active.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(
uri,
ncvar,
storage_type=None,
max_threads=100,
max_threads=150,
storage_options=None,
active_storage_url=None
):
Expand Down Expand Up @@ -469,6 +469,7 @@ def _process_chunk(self, session, fsref, chunk_coords, chunk_selection, counts,
Note the need to use counts for some methods
"""
t1c = time.time()
coord = '.'.join([str(c) for c in chunk_coords])
key = f"{self.ncvar}/{coord}"
try:
Expand All @@ -478,7 +479,7 @@ def _process_chunk(self, session, fsref, chunk_coords, chunk_selection, counts,

# S3: pass in pre-configured storage options (credentials)
if self.storage_type == "s3":
print("S3 rfile is:", rfile)
# print("S3 rfile is:", rfile)
parsed_url = urllib.parse.urlparse(rfile)
bucket = parsed_url.netloc
object = parsed_url.path
Expand All @@ -490,8 +491,8 @@ def _process_chunk(self, session, fsref, chunk_coords, chunk_selection, counts,
if bucket == "":
bucket = os.path.dirname(object)
object = os.path.basename(object)
print("S3 bucket:", bucket)
print("S3 file:", object)
# print("S3 bucket:", bucket)
# print("S3 file:", object)
if self.storage_options is None:
tmp, count = reductionist.reduce_chunk(session,
S3_ACTIVE_STORAGE_URL,
Expand All @@ -505,15 +506,13 @@ def _process_chunk(self, session, fsref, chunk_coords, chunk_selection, counts,
operation=self._method)
else:
# special case for "anon=True" buckets that work only with e.g.
# fs = s3fs.S3FileSystem(anon=True, client_kwargs={'endpoint_url': S3_URL})
# "fs = s3fs.S3FileSystem(anon=True, client_kwargs={'endpoint_url': S3_URL})"
# where file uri = bucketX/fileY.mc
print("S3 Storage options:", self.storage_options)
# print("S3 Storage options:", self.storage_options)
if self.storage_options.get("anon", None) == True:
bucket = os.path.dirname(parsed_url.path) # bucketX
object = os.path.basename(parsed_url.path) # fileY
print("S3 anon=True Bucket and File:", bucket, object)
t2 = time.time()
print("Total time before going in Reductionist", t2 - t1)
tmp, count = reductionist.reduce_chunk(session,
self.active_storage_url,
self._get_endpoint_url(),
Expand All @@ -533,7 +532,8 @@ def _process_chunk(self, session, fsref, chunk_coords, chunk_selection, counts,
missing, self.zds._dtype,
self.zds._chunks, self.zds._order,
chunk_selection, method=self.method)

t2c = time.time()
print("Chunk processing time via _process_chunk()", t2c - t1c)
if self.method is not None:
return tmp, count
else:
Expand Down

0 comments on commit 730f6ec

Please sign in to comment.