Skip to content

feat: show estimated time remaining for in-progress jobs#992

Merged
crowecawcaw merged 3 commits intoaws-deadline:mainlinefrom
vinadomi11:feat/estimated-completion-time
Mar 16, 2026
Merged

feat: show estimated time remaining for in-progress jobs#992
crowecawcaw merged 3 commits intoaws-deadline:mainlinefrom
vinadomi11:feat/estimated-completion-time

Conversation

@vinadomi11
Copy link
Contributor

@vinadomi11 vinadomi11 commented Feb 5, 2026

What was the problem/requirement? (What/Why)

Users have no way to see estimated time remaining for in-progress jobs from the CLI. This makes it harder to plan and monitor long-running render jobs.

What was the solution? (How)

Added a --show-estimates flag to deadline job list and deadline job get commands that displays estimated time remaining for in-progress jobs. The estimate is calculated by:

Computing average time per completed task
Multiplying by remaining tasks (running + pending)
Output shows human-readable durations like "5 minutes" or "1 hour, 30 minutes".

What is the impact of this change?

New optional CLI flag - no impact on existing behavior.

How was this change tested?

Have you run the unit tests?
Have you run the integration tests?
Was this change documented?

Are relevant docstrings in the code base updated?
Has the README.md been updated?
Does this PR introduce new dependencies?

This PR does not add any new dependencies.
Is this a breaking change?

No - this adds an optional flag with no changes to existing behavior.

Does this change impact security?

No security impact.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@vinadomi11 vinadomi11 requested a review from a team as a code owner February 5, 2026 20:18
def cli_job():
"""
def _format_duration(seconds: float) -> str:
"""Format seconds as human-readable duration (e.g., '1 hour, 30 minutes')."""
Copy link

@jairaws jairaws Feb 5, 2026

Choose a reason for hiding this comment

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

There seems to an issue with the comment quotes (e.g. """). The one in line 108 should be removed.

Copy link

Choose a reason for hiding this comment

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

Issue addressed in the latest revision.

return ", ".join(parts)


def _estimate_completion_time(job: dict) -> Optional[str]:
Copy link

Choose a reason for hiding this comment

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

Clever!

Copy link

Choose a reason for hiding this comment

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

This is pretty cool, @vinadomi11! Could we add unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just updated!

def cli_job():
"""
def _format_duration(seconds: float) -> str:
"""Format seconds as human-readable duration (e.g., '1 hour, 30 minutes')."""
Copy link

Choose a reason for hiding this comment

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

Issue addressed in the latest revision.

)
class TestEstimateCompletionTime:
def test_format_duration_seconds(self):
from deadline.client.cli._groups.job_group import _format_duration
Copy link

Choose a reason for hiding this comment

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

Could we move all the imports to the top of the file? As opposed to have an import in each test.

@_handle_error
def cli_job():
"""
"""
Copy link
Contributor

Choose a reason for hiding this comment

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

The spacing is broken here. You should be able to run 'hatch run fmt' to fix this up to 4 instead of 3 spaces.

This docstring should also not change in your PR. I see that below, it's adjacent to code, which looks wrong.

parts = [f"{hours} hour{'s' if hours != 1 else ''}"]
if mins:
parts.append(f"{mins} minute{'s' if mins != 1 else ''}")
return ", ".join(parts)
Copy link
Contributor

Choose a reason for hiding this comment

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

This helper function could go into _job_helpers.py instead of in this main job_group file, to keep this one focused on the interface itself.

},
}

with patch.object(api._session, "get_boto3_session") as session_mock:
Copy link
Contributor

Choose a reason for hiding this comment

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

We're using the deadline_mock fixture for this instead of patching the boto3 session directly, it would be great to switch these tests over to that.

@crowecawcaw
Copy link
Contributor

Instead of adding a new --show-estimates flag, what do you think about always showing the estimates? Seems like putting it behind a flag will make it less likely someone will find and use it.

@vinadomi11 vinadomi11 force-pushed the feat/estimated-completion-time branch from 35106ac to 2afb32e Compare March 5, 2026 21:40
@vinadomi11 vinadomi11 requested a review from a team as a code owner March 5, 2026 21:40
@vinadomi11 vinadomi11 changed the title feat: add --show-estimates flag to job list and job get feat: show estimated time remaining for in-progress jobs Mar 5, 2026
@vinadomi11 vinadomi11 force-pushed the feat/estimated-completion-time branch 2 times, most recently from fff6b22 to aa53b4c Compare March 10, 2026 20:25
@vinadomi11 vinadomi11 closed this Mar 10, 2026
@vinadomi11 vinadomi11 force-pushed the feat/estimated-completion-time branch from aa53b4c to 478bf6e Compare March 10, 2026 20:34
@vinadomi11 vinadomi11 reopened this Mar 10, 2026
@vinadomi11 vinadomi11 force-pushed the feat/estimated-completion-time branch from eb29ac7 to e6b4b83 Compare March 10, 2026 21:46
Add estimated time remaining to 'deadline job list' and 'deadline job get'
output. The estimate is calculated by computing average time per completed
task and multiplying by remaining tasks. Output shows human-readable
durations like '5 minutes' or '1 hour, 30 minutes'.

Shows 'N/A' when an estimate cannot be computed (e.g., no tasks completed
yet, or job is already done).

Signed-off-by: vtubbs <vtubbs@amazon.com>
@vinadomi11 vinadomi11 force-pushed the feat/estimated-completion-time branch from e6b4b83 to bdd2bb2 Compare March 11, 2026 21:47
@crowecawcaw crowecawcaw enabled auto-merge (squash) March 16, 2026 18:44
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

1 similar comment
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@crowecawcaw crowecawcaw merged commit 509af3c into aws-deadline:mainline Mar 16, 2026
48 of 49 checks passed
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.

4 participants