Skip to content

Add defensive programming checks for progress setting and calculation #13328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

rtibbles
Copy link
Member

Summary

  • Adds a check so we don't accidentally try to divide by None
  • Adds a check and warning to prevent invalid values for progress and total_progress from being set

References

Fixes #13321

Reviewer guidance

Do a quick smoke test of content import for a new channel to ensure against regressions in task calculation

@github-actions github-actions bot added the DEV: backend Python, databases, networking, filesystem... label Apr 16, 2025
@rtibbles rtibbles added the P0 - critical Priority: Release blocker or regression label Apr 16, 2025
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Code changes lgtm overall. Just a question about maybe raising an error when the values given to update_progress are bad.

Will leave approval to QA

Comment on lines +257 to +259
logger.warning(
f"Tried to set invalid progress values on job {self.job_id} for task {self.func} with progress: {progress} and total_progress {total_progress}"
)
Copy link
Member

Choose a reason for hiding this comment

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

Would it be helpful here to raise a ValueError here? I can see myself missing the warning in the logs if I were coming at this while debugging in progress updating on the front-end or something. Not a blocking comment - just a thought.

Copy link
Member Author

Choose a reason for hiding this comment

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

My reason for only logging is that given we have seen this in the wild (as per the issue) I don't want to cause existing jobs to fail just because of a progress tracking error.

@radinamatic
Copy link
Member

Variety of import/update/delete scenarios where performed with few resources and complete channels on both Ubuntu and Windows, no issues or regressions observed in the UI, task manager page or the console.

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

Manual QA passes, ready to go! 💯 :shipit:

@rtibbles rtibbles merged commit 8ec06a1 into learningequality:release-v0.18.0 Apr 17, 2025
52 checks passed
@rtibbles rtibbles deleted the defend_your_progress branch April 17, 2025 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DEV: backend Python, databases, networking, filesystem... P0 - critical Priority: Release blocker or regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants