Skip to content
Snippets Groups Projects
Commit 4bc30b7e authored by Ian's avatar Ian Committed by Ian
Browse files

style: replace print statements with logging calls in JobManager.py

parent 24b20e14
No related branches found
No related tags found
No related merge requests found
...@@ -151,7 +151,7 @@ class JobManager: ...@@ -151,7 +151,7 @@ class JobManager:
self.ledger.remove_job(job.job_id) self.ledger.remove_job(job.job_id)
# Submit new jobs # Submit new jobs
logging.info(f"Resubmitting {len(new_jobs)} failed jobs") logging.info(f"Resubmitting {len(new_jobs)} failed jobs...")
for job in new_jobs: for job in new_jobs:
try: try:
job.submit() job.submit()
...@@ -171,12 +171,13 @@ class JobManager: ...@@ -171,12 +171,13 @@ class JobManager:
) )
try: try:
time.sleep(3) time.sleep(3)
print("Resuming monitoring...") logging.info("Resuming monitoring...")
self.monitor() self.monitor()
except KeyboardInterrupt: except KeyboardInterrupt:
if self.redo_enabled and self.prompt_for_redo(): if self.redo_enabled and self.prompt_for_redo():
print("Resubmitting failed jobs...") logging.info("Resubmitting failed jobs...")
self.resubmit_jobs() self.resubmit_jobs()
logging.info("Resuming monitoring...")
self.monitor() self.monitor()
else: else:
self.exit_gracefully() self.exit_gracefully()
...@@ -199,7 +200,7 @@ class JobManager: ...@@ -199,7 +200,7 @@ class JobManager:
def exit_gracefully(self) -> None: def exit_gracefully(self) -> None:
"""Cancel pending jobs, print a report, and exit""" """Cancel pending jobs, print a report, and exit"""
print("\nExiting...") logging.info("\nExiting gracefully...")
# Cancel all pending jobs # Cancel all pending jobs
pending_jobs = self.ledger.get_pending_jobs() pending_jobs = self.ledger.get_pending_jobs()
...@@ -208,7 +209,7 @@ class JobManager: ...@@ -208,7 +209,7 @@ class JobManager:
job.cancel() job.cancel()
except Exception as e: except Exception as e:
logging.error(f"Error cancelling job: {e}") logging.error(f"Error cancelling job: {e}")
print("All jobs cancelled.") logging.info("All pending jobs cancelled.")
self.report() self.report()
exit(0) exit(0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment