File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import logging
88import os
99from pathlib import Path
10+ import platform
11+ import resource
1012from zoneinfo import ZoneInfo
1113
1214import earthaccess
@@ -293,6 +295,20 @@ def append_hd5_to_s3_zarr(
293295 }
294296 }
295297
298+ # add a check for how much memory is in use
299+ # tracemalloc.start()
300+
301+ # current, _ = tracemalloc.get_traced_memory()
302+ # print(f"Current memory in use: {current} bytes")
303+
304+ usage = resource .getrusage (resource .RUSAGE_SELF )
305+ if platform .system () == "Darwin" :
306+ rss_mb = usage .ru_maxrss / 1024 / 1024 # macOS: bytes
307+ else :
308+ rss_mb = usage .ru_maxrss / 1024 # Linux: kilobytes
309+
310+ print (f"Peak RSS: { rss_mb :.1f} MB" )
311+
296312 if store_exists :
297313 ds .to_zarr (
298314 store = zarr_mapper ,
Original file line number Diff line number Diff line change 1616 get_previously_downloaded_urls ,
1717 get_smap_data_list_for_arizona ,
1818 get_total_size_in_gb ,
19+ update_checkpoint ,
1920)
2021import minio
2122import s3fs
@@ -109,6 +110,11 @@ def main(
109110 LOGGER .warning ("Stopping early since test mode was specified" )
110111 break
111112
113+ LOGGER .info (
114+ f"Updating checkpoint file with new file { hd5_file_path [0 ].name } "
115+ )
116+ update_checkpoint (mc , bucket , hd5_file_path [0 ].name )
117+
112118 LOGGER .info ("Done!" )
113119
114120
You can’t perform that action at this time.
0 commit comments