comparison snp-cache.py @ 4:66f988a9666f

planemo upload commit b'7f6183b769772449fbcee903686b8d5ec5b7439f\n'-dirty
author jpayne
date Wed, 24 Jan 2018 15:51:36 -0500
parents eefdd97a6749
children 6adaecff5f2b
comparison
equal deleted inserted replaced
3:5830791e73af 4:66f988a9666f
101 try: 101 try:
102 api_key = os.environ.get('AWS_API_KEY', '') 102 api_key = os.environ.get('AWS_API_KEY', '')
103 s3 = boto3.resource('s3').Bucket(CACHE_NAMESPACE) 103 s3 = boto3.resource('s3').Bucket(CACHE_NAMESPACE)
104 s3.download_fileobj(name, output_f) 104 s3.download_fileobj(name, output_f)
105 logging.getLogger('snp-cache.cache').info(f"cache hit on {name}, retrieved.") 105 logging.getLogger('snp-cache.cache').info(f"cache hit on {name}, retrieved.")
106 except (DataNotFoundError, NoCredentialsError, BotoCoreError) as e: 106 except (DataNotFoundError, NoCredentialsError, BotoCoreError, ClientError) as e:
107 if type(e) is DataNotFoundError: 107 if type(e) is DataNotFoundError:
108 logging.getLogger('snp-cache.cache').info(f"cache miss on {name}") 108 logging.getLogger('snp-cache.cache').info(f"cache miss on {name}")
109 else: 109 else:
110 logging.getLogger('snp-cache.cache').error(e) 110 logging.getLogger('snp-cache.cache').error(e)
111 #if we couldn't find the data, we need to run the command to generate it 111 #if we couldn't find the data, we need to run the command to generate it