Skip to content

Commit d52176f

Browse files
committed
adding error catch to not exit if 404
1 parent b121dd8 commit d52176f

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

singularity/build/google.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
from googleapiclient.discovery import build
2222
from oauth2client.client import GoogleCredentials
23+
from googleapiclient.errors import HttpError
2324
from googleapiclient import http
2425

2526
from glob import glob
@@ -76,15 +77,20 @@ def get_bucket(storage_service,bucket_name):
7677
return req.execute()
7778

7879

79-
@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)
80+
@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000,stop_max_attempt_number=10)
8081
def delete_object(storage_service,bucket_name,object_name):
8182
'''delete_file will delete a file from a bucket
8283
:param storage_service: the service obtained with get_storage_service
8384
:param bucket_name: the name of the bucket (eg singularity-hub)
8485
:param object_name: the "name" parameter of the object.
8586
'''
86-
return storage_service.objects().delete(bucket=bucket_name,
87-
object=object_name).execute()
87+
try:
88+
operation = storage_service.objects().delete(bucket=bucket_name,
89+
object=object_name).execute()
90+
except HttpError as e:
91+
pass
92+
operation = e
93+
return operation
8894

8995

9096
@retry(wait_exponential_multiplier=1000, wait_exponential_max=10000)

singularity/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "1.0.5"
1+
__version__ = "1.0.7"
22
AUTHOR = 'Vanessa Sochat'
33
AUTHOR_EMAIL = '[email protected]'
44
NAME = 'singularity'

0 commit comments

Comments
 (0)