Merge pull request #17997 from edx/youngstrom/enable-s3-cache-devstack
Use s3 db cache on devstack
This commit is contained in:
@@ -125,11 +125,17 @@ def does_fingerprint_on_disk_match(fingerprint):
|
||||
|
||||
def is_fingerprint_in_bucket(fingerprint, bucket_name):
|
||||
"""
|
||||
Test if a zip file matching the given fingerprint is present within an s3 bucket
|
||||
Test if a zip file matching the given fingerprint is present within an s3 bucket.
|
||||
If there is any issue reaching the bucket, show the exception but continue by
|
||||
returning False
|
||||
"""
|
||||
zipfile_name = '{}.tar.gz'.format(fingerprint)
|
||||
conn = boto.connect_s3(anon=True)
|
||||
bucket = conn.get_bucket(bucket_name)
|
||||
try:
|
||||
conn = boto.connect_s3(anon=True)
|
||||
bucket = conn.get_bucket(bucket_name)
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
print("Exception caught trying to reach S3 bucket {}: {}".format(bucket_name, e))
|
||||
return False
|
||||
key = boto.s3.key.Key(bucket=bucket, name=zipfile_name)
|
||||
return key.exists()
|
||||
|
||||
|
||||
@@ -136,14 +136,9 @@ def reset_test_database():
|
||||
"""
|
||||
Reset the database used by the bokchoy tests.
|
||||
|
||||
If the tests are being run on Jenkins, use the database cache automation
|
||||
defined in pavelib/database.py
|
||||
If not, reset the test database and apply migrations
|
||||
Use the database cache automation defined in pavelib/database.py
|
||||
"""
|
||||
if os.environ.get('USER', None) == 'jenkins':
|
||||
update_local_bokchoy_db_from_s3() # pylint: disable=no-value-for-parameter
|
||||
else:
|
||||
sh("{}/scripts/reset-test-db.sh --migrations".format(Env.REPO_ROOT))
|
||||
update_local_bokchoy_db_from_s3() # pylint: disable=no-value-for-parameter
|
||||
|
||||
|
||||
@task
|
||||
|
||||
Reference in New Issue
Block a user