Skip to content

Commit 9691829

Browse files
author
Ubuntu
committed
changed print to log
1 parent 3049cbc commit 9691829

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/aging_gan/train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def main() -> None:
725725
metrics_path = out_dir / "test_metrics.json"
726726
with metrics_path.open("w") as f:
727727
json.dump(test_metrics, f, indent=4)
728-
print(f"Saved test metrics to {metrics_path}")
728+
logger.info(f"Saved test metrics to {metrics_path}")
729729
# upload outputs to s3 bucket
730730
if cfg.archive_and_terminate_ec2:
731731
archive_ec2(bucket=cfg.s3_bucket_name, prefix=f"outputs/run-{run_name}")

src/aging_gan/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def archive_ec2(
157157
"""Syncs everything under ./outputs to `s3://{bucket}/{prefix}/`."""
158158
# Upload
159159
out_root = Path(__file__).resolve().parents[2] / "outputs"
160-
print(f"Uploading {out_root} -> s3://{bucket}/{prefix}/ ...")
160+
logger.info(f"Uploading {out_root} -> s3://{bucket}/{prefix}/ ...")
161161
cmd = [
162162
"aws",
163163
"s3",
@@ -167,7 +167,7 @@ def archive_ec2(
167167
"--only-show-errors", # quieter logging
168168
]
169169
subprocess.run(cmd, check=True)
170-
print("S3 sync complete")
170+
logger.info("S3 sync complete")
171171

172172

173173
def terminate_ec2() -> None:
@@ -195,11 +195,11 @@ def terminate_ec2() -> None:
195195
headers=imds_hdr,
196196
timeout=2,
197197
).text
198-
print(f"Terminating {instance_id} in {region}")
198+
logger.info(f"Terminating {instance_id} in {region}")
199199

200200
# Terminate self
201201
ec2 = boto3.client("ec2", region_name=region)
202202
ec2.terminate_instances(InstanceIds=[instance_id])
203-
print("Termination request sent - instance will shut down shortly")
203+
logger.info("Termination request sent - instance will shut down shortly")
204204
# give AWS a moment so the print flushes before power‑off
205205
time.sleep(5)

0 commit comments

Comments
 (0)