-
Notifications
You must be signed in to change notification settings - Fork 240
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
workaround for S3 in us-east-1 #3710
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
177e3f8
workaround for https://github.com/boto/boto3/issues/125
mr-c acbe720
Merge branch 'master' into issues/3709-workaround-boto3-us-east-1-bucket
mr-c 8716d04
Add a docstring to the new function
adamnovak 570cfb3
Add the new lib/aws tests to a CI job so they run
adamnovak 6122d89
Merge branch 'master' into issues/3709-workaround-boto3-us-east-1-bucket
mr-c 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
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Copyright (C) 2021 Michael R. Crusoe | ||
# | ||
# 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 logging | ||
import os | ||
import uuid | ||
from typing import Optional | ||
|
||
from toil.jobStores.aws.jobStore import AWSJobStore | ||
from toil.lib.aws.utils import create_s3_bucket | ||
from toil.lib.ec2 import establish_boto3_session | ||
from toil.test import ToilTest, needs_aws_s3 | ||
|
||
logger = logging.getLogger(__name__) | ||
logging.basicConfig(level=logging.DEBUG) | ||
|
||
|
||
@needs_aws_s3 | ||
class S3Test(ToilTest): | ||
"""Confirm the workarounds for us-east-1.""" | ||
|
||
from mypy_boto3_s3 import S3ServiceResource | ||
from mypy_boto3_s3.service_resource import Bucket | ||
|
||
s3_resource: Optional[S3ServiceResource] | ||
bucket: Optional[Bucket] | ||
|
||
@classmethod | ||
def setUpClass(cls) -> None: | ||
session = establish_boto3_session(region_name="us-east-1") | ||
cls.s3_resource = session.resource("s3", region_name="us-east-1") | ||
cls.bucket = None | ||
|
||
def test_create_bucket(self) -> None: | ||
"""Test bucket creation for us-east-1.""" | ||
bucket_name = f"toil-s3test-{uuid.uuid4()}" | ||
assert self.s3_resource | ||
self.bucket = create_s3_bucket(self.s3_resource, bucket_name, "us-east-1") | ||
self.bucket.wait_until_exists() | ||
owner_tag = os.environ.get("TOIL_OWNER_TAG") | ||
if owner_tag: | ||
bucket_tagging = self.s3_resource.BucketTagging(bucket_name) | ||
bucket_tagging.put( | ||
Tagging={"TagSet": [{"Key": "Owner", "Value": owner_tag}]} | ||
) | ||
self.assertTrue(AWSJobStore.getBucketRegion, "us-east-1") | ||
|
||
@classmethod | ||
def tearDownClass(cls) -> None: | ||
if cls.bucket: | ||
AWSJobStore._delete_bucket(cls.bucket) | ||
super().tearDownClass() |
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.
The new test is already run as part of the
quick_test_offline
https://ucsc-ci.com/databiosphere/toil/-/jobs/90265/raw
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.
But isn't it an online test? Shouldn't it be pulled out of there?
make test_offline
isn't supposed to need Internet access according to the Makefile.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.
I agree, it is an online test. Lots of the
needs_aws
tests run in thequick_test_offline
, including the entireAWSJobStoreTest
suite!Can we merge this and fix the test distribution in a separate PR?
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.
I opened #3717
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.
We might have already had an issue for that; I guess we need a new decorator or something. We probably don't need to fix it here.