-
-
Notifications
You must be signed in to change notification settings - Fork 168
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
Feat worker limit #142
Merged
Merged
Feat worker limit #142
Changes from 3 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
82614b2
feat: add queue_read_limit to limit the number of job IDs read at eac…
rubik cbc5eb2
fix: set offset to None in case the limit is not specified
rubik dc3cd62
chore: format code
rubik c3a4ccf
fix: set queue_read_limit to max_jobs if not specified
rubik 10c9def
chore: refactor worker poll iteration into a separate method and writ…
rubik 930af48
chore: add history note
rubik ca7e3f7
chore: format code
rubik 5c487a0
chore: format docstring
rubik b50397e
fix: remove additional call to Redis introduced by mistake
rubik 8328a60
chore: remove unneeded call to create_pool in queue_read_limit tests
rubik 443302f
chore: assign queue_read_limit in one line
rubik 13ab4ed
chore: increase delay in queue_read_limit tests for CI systems
rubik f0c6a24
Merge branch 'master' into feat-worker-limit
rubik 6ede7ef
chore: fix linting errors
rubik c1468e9
fix remaining sleeps
samuelcolvin 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 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 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 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
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.
maybe this shouldn't be optional?
Is there any reason not to set it to
1000
ormax_jobs
?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.
@rubik did you see this comment? What do you think?
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.
@samuelcolvin I agree, yes. One of the last commits sets it to
max_jobs
if it's None.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.
okay, so the type shouldn't be
Optional
, on the classshould be:
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.
@samuelcolvin I don't follow. In your line with
or
you allowqueue_read_limit
to beNone
. That means that we need to keepOptional
in the type hint. If the user does not specify it, it'sNone
. I changed the assignment to be a one-liner like yours.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.
What you've done is correct.
My point is that if you do:
Mypy reads this as implicitly setting the type of
bar
toOptional[int]
, that doesn't change in theif
block.If instead you do
The type of
bar
isint
, this is what we do above, except we're explicit and add a type hint.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.
@samuelcolvin Now I understand, thanks for the explanation.