-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Closes #2108. New boto session for each thread #2136
Merged
Merged
Conversation
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
Naive solution that always initializes a new boto3 session and client whenever accessed, regardless of what thread we are in
Utilize the task context to initialize a new boto3 session and client if this task didn't make one already
In retrospect, I probably don't need to get in the cache key but can just go on context directly.
cicdw
reviewed
Mar 10, 2020
cicdw
previously approved these changes
Mar 10, 2020
cicdw
approved these changes
Mar 10, 2020
zanieb
pushed a commit
that referenced
this pull request
Jul 8, 2022
Add a system block that pulls its value from env var
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.
Thanks for contributing to Prefect!
Please describe your work and make sure your PR:
CHANGELOG.md
(if appropriate)docs/outline.toml
for API reference docs (if appropriate)Note that your PR will not be reviewed unless all three boxes are checked.
What does this PR change?
Instantiates a new boto session (and thus boto client) if we think we are in a new thread. Closes #2108 which has a lot of context for this. In the end (see commit history for the history) I went with memoizing the boto client not on the result handler instance as before, but in
prefect.context
. Anecdotally, initializing at every call toS3ResultHandler.client
a la 0852c2c made the dask example flow twice as slow with two local dask workers using--nprocs 1 --nthreads 3
.Why is this PR important?
Tasks on multithreaded executors can now use the S3ResultHandler (before tasks would fail when initializing the boto client).
❓ NOTE ❓ : Should I be attempting to add an integration test testing this edge between Dask executor, mapped flows and S3?