|
11 | 11 |
|
12 | 12 | from singularity.package import ( |
13 | 13 | build_from_spec, |
14 | | - #estimate_image_size, |
| 14 | + estimate_image_size, |
15 | 15 | package |
16 | 16 | ) |
17 | 17 |
|
@@ -94,21 +94,23 @@ def run_build(build_dir,params,verbose=True): |
94 | 94 |
|
95 | 95 | # If size is None, set default of 800 |
96 | 96 | if params['size'] in [None,'']: |
97 | | - bot.logger.info("""\n\n-------------------------------------------------------------- |
| 97 | + bot.logger.info("""\n |
| 98 | + -------------------------------------------------------------- |
98 | 99 | Size not detected for build. Will use default of 800MB padding. If |
99 | 100 | your build fails due to running out of disk space, you can adjust the |
100 | 101 | size under collection --> edit builder |
101 | 102 | --------------------------------------------------------------------- |
102 | 103 | \n""") |
103 | 104 |
|
104 | | - params['size'] = 800 |
105 | | - |
106 | | - # In future we can possibly add this back. |
107 | | - #params['size'] = estimate_image_size(spec_file=os.path.abspath(params['spec_file']), |
108 | | - # sudopw='', |
109 | | - # padding=params['padding']) |
110 | | - #bot.logger.info("Size estimated as %s",params['size']) |
111 | | - |
| 105 | + # Testing estimation of size |
| 106 | + try: |
| 107 | + params['size'] = estimate_image_size(spec_file=os.path.abspath(params['spec_file']), |
| 108 | + sudopw='', |
| 109 | + padding=params['padding']) |
| 110 | + bot.logger.info("Size estimated as %s",params['size']) |
| 111 | + except: |
| 112 | + params['size'] = 800 |
| 113 | + bot.logger.info("Size estimation didn't work, using default %s",params['size']) |
112 | 114 |
|
113 | 115 | # START TIMING |
114 | 116 | start_time = datetime.now() |
|
0 commit comments