Repository navigation
Reset the rich progress bar between executions of the same driver - #1824
Open
dhananjay6561 wants to merge 2 commits into
Open
dhananjay6561 wants to merge 2 commits into
dhananjay6561 wants to merge 2 commits into
Conversation
Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
Signed-off-by: dhananjay6561 <dhananjayaggarwal6561@gmail.com>
Author
|
Hi @skrawcz @jernejfrank, a small one for the rich progress bar. Reusing a driver kept stacking empty bars and over-counting the first one, so this clears the previous run's bars at the start of each execution. Added the first tests for that adapter too. Thanks for taking a look! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
h_rich.RichProgressBaronly works for the first execution of a driver. The adapter lives on the driver, and everyrun_before_graph_executionadds another task to the samerichProgresswhile all the advancing still goes totask_ids[0]. So when you build a driver once and callexecutea few times (the usual pattern), the first bar keeps counting past its total and every later run adds a bar that stays at 0%:The same happens with dynamic execution: on the second run the "Running" bar goes to 8/4 and the new one stays empty.
Changes
run_before_graph_executionremoves the previous run's tasks and resets_task_basedbefore adding the new bar, so each execution starts from a clean progress bar.tests/plugins/test_h_rich.py(there were no tests for this adapter yet): one for a single run reaching its total, one for a reused driver.How I tested this
test_progress_bar_starts_fresh_on_each_executionfails on main (two tasks instead of one) and passes with the change.pytest tests/plugins/test_h_rich.py tests/plugins/test_h_tqdm.py(5 passed).Parallelizable/CollectDAG executed twice with the setup from the class docstring: each run now shows only its own bars with correct counts.ruff format --checkandruff check(0.16.9) on the touched files.Notes
richcomes in throughtyperin the test group, but the test module usespytest.importorskip("rich")so it skips cleanly if it isn't installed.Checklist