-
Notifications
You must be signed in to change notification settings - Fork 144
python: surface commit/ingest progress in wait loop warnings #6780
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
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| """Tests for GlobalPipelineMetrics.progress_summary(), which lets wait loops | ||
| (Pipeline.wait_for_completion, testutils.wait_end_of_input) report whether a | ||
| long wait is stalled or just slow.""" | ||
|
|
||
| from feldera.stats import CommitProgressSummary, GlobalPipelineMetrics | ||
|
|
||
| BASE_METRICS_DICT = { | ||
| "state": "running", | ||
| "incarnation_uuid": "00000000-0000-0000-0000-000000000000", | ||
| "start_time": 0, | ||
| "transaction_status": "NoTransaction", | ||
| "total_processed_records": 42, | ||
| "total_input_records": 100, | ||
| } | ||
|
|
||
|
|
||
| def test_commit_progress_absent_when_no_transaction(): | ||
| metrics = GlobalPipelineMetrics.from_dict(BASE_METRICS_DICT) | ||
| assert metrics.commit_progress is None | ||
|
|
||
|
|
||
| def test_commit_progress_parsed_into_object(): | ||
| d = { | ||
| **BASE_METRICS_DICT, | ||
| "commit_progress": { | ||
| "completed": 3, | ||
| "in_progress": 2, | ||
| "remaining": 1, | ||
| "in_progress_processed_records": 10, | ||
| "in_progress_total_records": 50, | ||
| }, | ||
| } | ||
| metrics = GlobalPipelineMetrics.from_dict(d) | ||
| assert isinstance(metrics.commit_progress, CommitProgressSummary) | ||
| assert metrics.commit_progress.completed == 3 | ||
| assert metrics.commit_progress.in_progress_total_records == 50 | ||
|
|
||
|
|
||
| def test_commit_progress_str_matches_rust_display_format(): | ||
| progress = CommitProgressSummary.from_dict( | ||
| { | ||
| "completed": 3, | ||
| "in_progress": 2, | ||
| "remaining": 1, | ||
| "in_progress_processed_records": 10, | ||
| "in_progress_total_records": 50, | ||
| } | ||
| ) | ||
| assert str(progress) == ( | ||
| "completed: 3 operators, evaluating: 2 operators " | ||
| "[10/50 changes processed], remaining: 1 operators" | ||
| ) | ||
|
|
||
|
|
||
| def test_progress_summary_falls_back_to_record_counts_outside_transaction(): | ||
| metrics = GlobalPipelineMetrics.from_dict(BASE_METRICS_DICT) | ||
| assert metrics.progress_summary() == "42/100 records processed" | ||
|
|
||
|
|
||
| def test_progress_summary_prefers_commit_progress_during_transaction(): | ||
| d = { | ||
| **BASE_METRICS_DICT, | ||
| "commit_progress": { | ||
| "completed": 0, | ||
| "in_progress": 1, | ||
| "remaining": 7, | ||
| "in_progress_processed_records": 0, | ||
| "in_progress_total_records": 169, | ||
| }, | ||
| } | ||
| metrics = GlobalPipelineMetrics.from_dict(d) | ||
| summary = metrics.progress_summary() | ||
| assert "0/169 changes processed" in summary | ||
| assert "records processed" not in summary |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this important?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's just informative.