Skip to content

Conversation

@pshapiro4broad
Copy link
Member

@pshapiro4broad pshapiro4broad commented Sep 19, 2025

When waiting for a batch of jobs to complete, show the number of batches remaining and a remaining time estimate based on the time taken so far.

INFO: 2025-09-19 10:32:29,954 : TDR job xf35gh5VRuWEH8pbeFtuPw succeeded
INFO: 2025-09-19 10:32:30,081 : TDR job HrVdd7AESIiDBFxpaqBNkg succeeded
INFO: 2025-09-19 10:32:30,213 : TDR job h0v3F6fNSly12WOM5b4AZw succeeded
INFO: 2025-09-19 10:32:30,215 : Completed batch 4 with 200 jobs. 
INFO: 2025-09-19 10:32:30,215 : Submitting jobs for batch 5 of 95 with 200 jobs
INFO: 2025-09-19 10:32:30,215 : Estimated time remaining: 158.92 minutes
INFO: 2025-09-19 10:32:30,215 : Submitting delete job for file 7a48d9bc-1191-4c17-93f8-c9311ba76fce
INFO: 2025-09-19 10:32:30,451 : Submitting delete job for file dff83bfc-0ff3-44cb-8abf-f834b4f8da2c
INFO: 2025-09-19 10:32:30,652 : Submitting delete job for file b85f1ed4-dfa7-4fc3-b98a-308cd3dd1242

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances batch job monitoring by adding progress tracking and time estimation capabilities. When processing batches of TDR jobs, users now see the current batch number, total batches remaining, and an estimated completion time based on historical batch durations.

Key Changes:

  • Added time tracking for batch durations to calculate estimated remaining time
  • Enhanced logging to display batch progress (current/total) and time estimates
  • Added type hints for improved code clarity

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
ops_utils/tdr_utils/tdr_job_utils.py Added batch duration tracking, time estimation logic, and enhanced progress logging with batch counts and remaining time
VERSION.txt Updated version to 12.2.1 with description of the new feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

failed_jobs = []
failed_jobs: list[str] = []
total_jobs = len(self.job_args_list)
batch_durations: list[Any] = []
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation list[Any] is too generic. Based on usage at line 162 where time.time() - start_time is appended, this should be list[float] to accurately represent batch duration values in seconds.

Suggested change
batch_durations: list[Any] = []
batch_durations: list[float] = []

Copilot uses AI. Check for mistakes.
batches_left = (total_jobs + self.batch_size - 1) // self.batch_size - batch_num
logging.info(
f"Submitting jobs for batch {i // self.batch_size + 1} with {len(current_batch)} jobs."
f"Submitting jobs for batch {batch_num} of {batches_left} with {len(current_batch)} jobs "
Copy link

Copilot AI Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The batch progress display is incorrect. Line 131 shows 'batch {batch_num} of {batches_left}', but batches_left represents remaining batches, not total batches. It should be 'batch {batch_num} of {total_batches}' where total_batches = (total_jobs + self.batch_size - 1) // self.batch_size.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants