-
Notifications
You must be signed in to change notification settings - Fork 244
New AWS jobstore. #5123
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
New AWS jobstore. #5123
Changes from 3 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
b0b1752
New aws jobstore.
DailyDreaming 7dc1a7c
Update.
DailyDreaming 06b7a40
Updates.
DailyDreaming 4c12449
Linting.
DailyDreaming 2900c99
Update.
DailyDreaming 3a345dd
Update from master.
DailyDreaming 9322285
Update.
DailyDreaming 031bab4
Update and rebase.
DailyDreaming c58e025
Update and rebase.
DailyDreaming 698b450
Assuage make docs's anger.
DailyDreaming b9f3cc8
Rebase.
DailyDreaming 321a2c6
Some compat, some review comments.
DailyDreaming faf0581
Move boto imports.
DailyDreaming a9a8880
Update.
DailyDreaming 082311d
Update comments, move imports, and update docstrings.
DailyDreaming 0608622
Update imports.
DailyDreaming 687b9b7
Merge branch 'master' into issues/964-aws-remove-sdb
DailyDreaming 133fc26
Merge remote-tracking branch 'upstream/master' into issues/964-aws-re…
adamnovak 0b2316b
Fix typing
adamnovak d778e1e
Enable type checking and fix utils typing
adamnovak aaf6085
Address code review comments, drop comments in docstrings, drop dupli…
adamnovak b99e462
Reformat and revise docs so docs build works
adamnovak 56faabd
Merge remote-tracking branch 'upstream/master' into issues/964-aws-re…
adamnovak 859dd2d
Quote possibly-unavailable types
adamnovak 4631950
Make missing AWS modules produce ImportError and not NotImplementedError
adamnovak 1f75eac
Stop trying to import the boto 2 error types
adamnovak 3a643b7
Use the key function everywhere and deal with not having a log place …
adamnovak 9e912b2
Add missing pre_update_hook call
adamnovak 654d8e7
Stop logging every write
adamnovak cc0f8c4
Only write the marker when it moves
adamnovak 7f3c3d2
Use the content key prefix when uploading files
adamnovak adef28a
Get executable bit from the end of the key fields
adamnovak 1122742
Add --toil suffix to test bucket cleanup script
adamnovak 14d1338
Make FileJobStore _write_to_url a classmethod again
adamnovak 2126540
Stop tracking executability in key because it is tracked in the typed…
adamnovak 3503b01
Merge remote-tracking branch 'upstream/master' into issues/964-aws-re…
adamnovak 5fc4c39
Fix self reference in classmethod
adamnovak 4a1de2e
Add pytest-randomly to report and set seeds only
adamnovak 05c04fc
Fix removed method and enable AWS util test type checking
adamnovak 7a3df6d
Move single-test teardown into test and fix argument type
adamnovak 80aabc9
Fix typing by moving import
adamnovak 47d2518
Merge remote-tracking branch 'upstream/master' into issues/964-aws-re…
adamnovak 7822305
Satisfy MyPy on the pipes
adamnovak 2d6d7ad
Respect turning off encryption for stream uploads so config.pickle ca…
adamnovak c369df4
Get the config from self
adamnovak bfc6616
Make AWS encryption settings update live from the config to satisfy test
adamnovak df02144
Handle error from trying to read without encryption, and default encr…
adamnovak 86a8fe6
Make Bucket from the resource and not free-floating
adamnovak 59b2eec
Satisfy MyPy
adamnovak 278fb2f
Avoid depending on strongly-consistent clean in subTest tests
adamnovak 4f55510
Raise correct nonexistent job store exception
adamnovak 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,78 @@ | ||
# Copyright (C) 2015-2021 Regents of the University of California | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
import urllib.parse as urlparse | ||
|
||
|
||
class InvalidImportExportUrlException(Exception): | ||
def __init__(self, url): | ||
""" | ||
:param urlparse.ParseResult url: | ||
""" | ||
super().__init__("The URL '%s' is invalid." % url.geturl()) | ||
|
||
|
||
class NoSuchJobException(Exception): | ||
"""Indicates that the specified job does not exist.""" | ||
def __init__(self, jobStoreID): | ||
""" | ||
:param str jobStoreID: the jobStoreID that was mistakenly assumed to exist | ||
""" | ||
super().__init__("The job '%s' does not exist." % jobStoreID) | ||
|
||
|
||
class ConcurrentFileModificationException(Exception): | ||
"""Indicates that the file was attempted to be modified by multiple processes at once.""" | ||
def __init__(self, jobStoreFileID): | ||
""" | ||
:param str jobStoreFileID: the ID of the file that was modified by multiple workers | ||
or processes concurrently | ||
""" | ||
super().__init__('Concurrent update to file %s detected.' % jobStoreFileID) | ||
|
||
|
||
class NoSuchFileException(Exception): | ||
"""Indicates that the specified file does not exist.""" | ||
def __init__(self, jobStoreFileID, customName=None, *extra): | ||
""" | ||
:param str jobStoreFileID: the ID of the file that was mistakenly assumed to exist | ||
:param str customName: optionally, an alternate name for the nonexistent file | ||
:param list extra: optional extra information to add to the error message | ||
""" | ||
# Having the extra argument may help resolve the __init__() takes at | ||
# most three arguments error reported in | ||
# https://github.com/DataBiosphere/toil/issues/2589#issuecomment-481912211 | ||
if customName is None: | ||
message = "File '%s' does not exist." % jobStoreFileID | ||
else: | ||
message = "File '%s' (%s) does not exist." % (customName, jobStoreFileID) | ||
|
||
if extra: | ||
# Append extra data. | ||
message += " Extra info: " + " ".join((str(x) for x in extra)) | ||
|
||
super().__init__(message) | ||
|
||
|
||
class NoSuchJobStoreException(Exception): | ||
"""Indicates that the specified job store does not exist.""" | ||
def __init__(self, locator): | ||
super().__init__("The job store '%s' does not exist, so there is nothing to restart." % locator) | ||
|
||
|
||
class JobStoreExistsException(Exception): | ||
"""Indicates that the specified job store already exists.""" | ||
def __init__(self, locator): | ||
super().__init__( | ||
"The job store '%s' already exists. Use --restart to resume the workflow, or remove " | ||
"the job store with 'toil clean' to start the workflow from scratch." % locator) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are all S3-related, so why aren't they in the S3 lib file? |
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,22 @@ | ||
S3_PARALLELIZATION_FACTOR = 8 | ||
S3_PART_SIZE = 16 * 1024 * 1024 | ||
KiB = 1024 | ||
MiB = KiB * KiB | ||
|
||
# Files must be larger than this before we consider multipart uploads. | ||
AWS_MIN_CHUNK_SIZE = 64 * MiB | ||
# Convenience variable for Boto3 TransferConfig(multipart_threhold=). | ||
MULTIPART_THRESHOLD = AWS_MIN_CHUNK_SIZE + 1 | ||
# Maximum number of parts allowed in a multipart upload. This is a limitation imposed by S3. | ||
AWS_MAX_MULTIPART_COUNT = 10000 | ||
|
||
|
||
def get_s3_multipart_chunk_size(filesize: int) -> int: | ||
"""Returns the chunk size of the S3 multipart object, given a file's size in bytes.""" | ||
if filesize <= AWS_MAX_MULTIPART_COUNT * AWS_MIN_CHUNK_SIZE: | ||
return AWS_MIN_CHUNK_SIZE | ||
else: | ||
div = filesize // AWS_MAX_MULTIPART_COUNT | ||
if div * AWS_MAX_MULTIPART_COUNT < filesize: | ||
div += 1 | ||
return ((div + MiB - 1) // MiB) * MiB |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.