Skip to content

Commit

Permalink
update polling interval to 60 seconds and make logging less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
mbthornton-lbl committed Dec 2, 2024
1 parent 7b1357a commit f5657a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions nmdc_automation/workflow_automation/watch_nmdc.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def update_operation(self, opid, done, meta):
class Watcher:
""" Watcher class for monitoring and managing jobs """
def __init__(self, site_configuration_file: Union[str, Path], state_file: Union[str, Path] = None):
self._POLL = 20
self._POLL = 60
self._MAX_FAILS = 2
self.should_skip_claim = False
self.config = SiteConfig(site_configuration_file)
Expand All @@ -342,14 +342,15 @@ def cycle(self):
self.restore_from_checkpoint()
# if not self.should_skip_claim: - is this actually used?
unclaimed_jobs = self.runtime_api_handler.get_unclaimed_jobs(self.config.allowed_workflows)
logger.info(f"Found {len(unclaimed_jobs)} unclaimed jobs.")
if unclaimed_jobs:
logger.info(f"Found {len(unclaimed_jobs)} unclaimed jobs.")
self.claim_jobs(unclaimed_jobs)


logger.info(f"Checking for finished jobs.")
logger.debug(f"Checking for finished jobs.")
successful_jobs, failed_jobs = self.job_manager.get_finished_jobs()
if not successful_jobs and not failed_jobs:
logger.info("No finished jobs found.")
logger.debug("No finished jobs found.")
for job in successful_jobs:
logger.info(f"Processing successful job: {job.opid}, {job.workflow_execution_id}")
job_database = self.job_manager.process_successful_job(job)
Expand Down Expand Up @@ -389,6 +390,7 @@ def watch(self):
logger.info("Entering polling loop")
while True:
try:
print(".")
self.cycle()
except (IOError, ValueError, TypeError, AttributeError) as e:
logger.exception(f"Error occurred during cycle: {e}", exc_info=True)
Expand Down

0 comments on commit f5657a4

Please sign in to comment.