Skip to content

Conversation

@Sushisource
Copy link
Member

What was changed

Added fairness keys/weights to priority

Why?

New feature

Checklist

  1. Closes

  2. How was this tested:
    Added test

  3. Any docs updates needed?

@Sushisource Sushisource requested a review from a team as a code owner August 20, 2025 19:14
:priority_key
:priority_key,
:fairness_key,
:weight
Copy link
Member

Choose a reason for hiding this comment

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

You called this fairness_weight in Python

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, dumb oversight

# 3. The default weight of 1.0 will be used.
#
# Weight values are clamped to the range [0.001, 1000].
class Priority
Copy link
Member

@cretz cretz Aug 20, 2025

Choose a reason for hiding this comment

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

So in Python you want priority_key to be provided on constructor, but have fairness_key and weight be optional? If so, you need to add an initialize in here that has the default params you want and calls super

attr_reader weight: Float?

def initialize: (priority_key: Integer?) -> void
def initialize: (priority_key: Integer?, ?fairness_key: String?, ?weight: Float?) -> void
Copy link
Member

Choose a reason for hiding this comment

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

Mentioned in other comment, but you'll need to write initialize if you want optional parameters (the default initialize of Data does not support default parameters, but it's easy to write yourself and call super)


# Initialize a new Priority instance.
#
# @param priority_key [Integer] The priority key
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# @param priority_key [Integer] The priority key
# @param priority_key [Integer, nil] The priority key

@Sushisource Sushisource enabled auto-merge (squash) August 20, 2025 21:56
@Sushisource Sushisource merged commit c3779da into main Aug 20, 2025
8 checks passed
@Sushisource Sushisource deleted the fairness branch August 20, 2025 22:07
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.

3 participants