INNER CODE UNIT · Python
log_processed_object
allenai/objaverse-xl · scripts/rendering/main.py:24
def log_processed_object(csv_filename: str, *args) -> None:
"""Log when an object is done being used.
Args:
csv_filename (str): Name of the CSV file to save the logs to.
*args: Arguments to save to the CSV file.
Returns:
None
"""
args = ",".join([str(arg) for arg in args])
# log that this object was rendered successfully
# saving locally to avoid excessive writes to the cloud
dirname = os.path.expanduser(f"~/.objaverse/logs/")
os.makedirs(dirname, exist_ok=True)
with open(os.path.join(dirname, csv_filename), "a", encoding="utf-8") as f:
f.write(f"{time.time()},{args}\n")