-
Notifications
You must be signed in to change notification settings - Fork 0
quorum refree #450
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
quorum refree #450
Conversation
Code ReviewSummaryThis PR adds a new ✅ Positive Aspects
🐛 Issues Found1. Missing Newline at End of File (src/rapidata/rapidata_client/referee/init.py:4)The from ._quorum_referee import QuorumReferee
# ^ missing newline hereFix: Add a newline at the end of the file. 2. Duplicate Type Checking Logic (src/rapidata/rapidata_client/referee/_quorum_referee.py:32-46)The constructor validates types in two places with inconsistent error messages: def __init__(self, threshold: int = 3, max_votes: int = 5):
if threshold < 1:
raise ValueError("The threshold must be greater than 0.")
if max_votes < 1:
raise ValueError("The number of max_votes must be greater than 0.")
if threshold > max_votes:
raise ValueError("The threshold cannot be greater than max_votes.")
super().__init__()
if not isinstance(threshold, int) or not isinstance(max_votes, int): # ⚠️
raise ValueError(
"The the quorum threshold and responses_per_datapoint must be integers." # ⚠️ typo "the the"
)Issues:
Recommendation:
def __init__(self, threshold: int = 3, max_votes: int = 5):
if not isinstance(threshold, int) or not isinstance(max_votes, int):
raise ValueError(
"The threshold and max_votes must be integers."
)
if threshold < 1:
raise ValueError("The threshold must be greater than 0.")
if max_votes < 1:
raise ValueError("The number of max_votes must be greater than 0.")
if threshold > max_votes:
raise ValueError("The threshold cannot be greater than max_votes.")
super().__init__()
self.threshold = threshold
self.max_votes = max_votes3. Inconsistent Logging (src/rapidata/rapidata_client/order/rapidata_order_manager.py:101-108)The debug log statement at line 101-108 doesn't include Current: logger.debug(
"Creating order with parameters: name %s, workflow %s, datapoints %s, responses_per_datapoint %s, validation_set_id %s, confidence_threshold %s, filters %s, settings %s, selections %s",
# missing quorum_thresholdRecommendation: Add 4. Unclear Stopping Behavior Documentation (src/rapidata/rapidata_client/referee/_quorum_referee.py:11-18)The class docstring mentions stopping "when a minimum number of responses agree" but doesn't clearly explain the early stopping behavior when quorum becomes mathematically impossible. Current: """A referee that completes a task when a specified number of responses agree.
This referee implements a quorum-based approach where a task is completed
when a minimum number of responses (threshold) agree on the same answer,
or when the maximum number of votes is reached.
For example, with threshold=3 and max_votes=5, the task completes when
3 responses agree on the same answer, or after 5 total votes if no
quorum is reached.The docstring in Recommendation: Update the class docstring to clarify the early stopping behavior: """A referee that completes a task when a specified number of responses agree.
This referee implements a quorum-based approach where a task is completed when:
1. A minimum number of responses (threshold) agree on the same answer, OR
2. Quorum becomes mathematically impossible to reach, OR
3. The maximum number of votes is reached
For example, with threshold=7 and max_votes=10:
- Task completes when 7 responses agree (quorum reached)
- Task completes when both options have 4+ responses (quorum impossible: 4+4=8 > 10-7)
- Task completes after 10 total votes if neither condition is met
|
Pull Request Review: Quorum Referee ImplementationOverviewThis PR introduces a new Code Quality & Best Practices✅ Strengths
|
Makuh17
left a comment
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.
Looks good. the minor changes are not pressing
| This referee implements a quorum-based approach where a task is completed | ||
| when a minimum number of responses (threshold) agree on the same answer, | ||
| or when the maximum number of votes is reached. |
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.
It also completes if it is impossible to reach quorum within the maximum number of votes
No description provided.