Skip to content

Commit

Permalink
Handle trailing / in config.
Browse files Browse the repository at this point in the history
Normalize logging for S3 cram and coverage classes.
  • Loading branch information
grosscol committed Oct 16, 2023
1 parent 631e69c commit d178e1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bravo_api/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.13.6
2.13.7
7 changes: 6 additions & 1 deletion bravo_api/core/s3_coverage_provider.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Provide coverage bin data backed by an S3 object.
"""
import logging
from bravo_api.core.coverage_provider import CoverageProvider, CoverageSourceInaccessibleError
from urllib.parse import urlparse
import rapidjson
Expand All @@ -10,18 +11,22 @@
from botocore.exceptions import ClientError
from functools import reduce

logger = logging.getLogger(__name__)


class S3CoverageProvider(CoverageProvider):

def __init__(self, src):
self.client = boto3.client('s3')
self.src = src
self.src = src.rstrip('/')
split_url = urlparse(self.src)
self.bucket = split_url.netloc
self.prefix = split_url.path.lstrip('/')
self.validate_source()
self.catalog = self.discover_files()

logger.debug('S3CoverageSource initialized.')

def validate_source(self):
"""
Validate that the bucket, prefix, and objects are accessible.
Expand Down
2 changes: 1 addition & 1 deletion bravo_api/core/s3_cram_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, src: str, ref: str, cache: [BaseCache, Cache] = None):
# self.validate()
self.configure_from_variant_map()

logger.debug('S3CramSource initialized Logged')
logger.debug('S3CramSource initialized.')

if(cache is None):
self.cache = SimpleCache(threshold=10)
Expand Down

0 comments on commit d178e1a

Please sign in to comment.