Skip to content

Commit 29b8f1f

Browse files
committed
modified: examples/singularity_hub/compare_builds.py
modified: singularity/hub/utils.py
1 parent 9b553b1 commit 29b8f1f

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

examples/singularity_hub/compare_builds.py

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# This is a simple script to use the singularity command line tool to obtain manifests
44
# and compare build specs (using Singularity Hub API)
55

6-
container_name = 'vsoch/singularity-hello-world'
7-
86
from singularity.hub.client import Client
97

108
import pickle
@@ -41,25 +39,22 @@ def get_top_os(x):
4139
container_ids = collection['container_set']
4240
cids = []
4341
for c in range(0,len(container_ids)):
44-
try:
45-
container_id = container_ids[c]
46-
cids.append(container_id)
47-
manifest = shub.get_container(container_id)
48-
container_uri = '%s-%s' %(container_name,manifest['version'])
49-
containers[container_uri] = manifest
50-
image = shub.pull_container(manifest,
51-
download_folder=storage,
52-
name="%s.img.gz" %(manifest['version']))
53-
metrics = shub.load_metrics(manifest)
54-
top_os = get_top_os(metrics['os_sims'])
55-
entry = [container_name,
56-
metrics['build_time_seconds'],
57-
metrics['size'],
58-
manifest['version'],
59-
top_os]
60-
df.loc[container_uri] = entry
61-
except:
62-
pass
42+
container_id = container_ids[c]
43+
cids.append(container_id)
44+
manifest = shub.get_container(container_id)
45+
container_uri = '%s-%s' %(container_name,manifest['version'])
46+
containers[container_uri] = manifest
47+
image = shub.pull_container(manifest,
48+
download_folder=storage,
49+
name="%s.img.gz" %(manifest['version']))
50+
metrics = shub.load_metrics(manifest)
51+
top_os = get_top_os(metrics['os_sims'])
52+
entry = [container_name,
53+
metrics['build_time_seconds'],
54+
metrics['size'],
55+
manifest['version'],
56+
top_os]
57+
df.loc[container_uri] = entry
6358

6459
results['containers'] = containers
6560
results['df'] = df

singularity/hub/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ def download_atomically(url,file_name,headers=None):
186186
os.close(fd)
187187
response = api_get(url,headers=headers,stream=tmp_file)
188188
if isinstance(response, HTTPError):
189-
logger.error("Error downloading %s, exiting.", url)
189+
bot.logger.error("Error downloading %s, exiting.", url)
190190
sys.exit(1)
191191
os.rename(tmp_file, file_name)
192192
except:
193193
download_folder = os.path.dirname(os.path.abspath(file_name))
194-
logger.error("Error downloading %s. Do you have permission to write to %s?", url, download_folder)
194+
bot.logger.error("Error downloading %s. Do you have permission to write to %s?", url, download_folder)
195195
try:
196196
os.remove(tmp_file)
197197
except:

0 commit comments

Comments
 (0)