MCPcopy Create free account
hub / github.com/apache/solr / download

Function download

dev-tools/scripts/scriptutil.py:185–205  ·  view source on GitHub ↗
(name, urlString, tmpDir, quiet=False, force_clean=True)

Source from the content-addressed store, hash-verified

183
184
185def download(name, urlString, tmpDir, quiet=False, force_clean=True):
186 if not quiet:
187 print("Downloading %s" % urlString)
188 startTime = time.time()
189 fileName = '%s/%s' % (tmpDir, name)
190 if not force_clean and os.path.exists(fileName):
191 if not quiet and fileName.find('.asc') == -1:
192 print(' already done: %.1f MB' % (os.path.getsize(fileName)/1024./1024.))
193 return
194 try:
195 attemptDownload(urlString, fileName)
196 except Exception as e:
197 print('Retrying download of url %s after exception: %s' % (urlString, e))
198 try:
199 attemptDownload(urlString, fileName)
200 except Exception as e:
201 raise RuntimeError('failed to download url "%s"' % urlString) from e
202 if not quiet and fileName.find('.asc') == -1:
203 t = time.time()-startTime
204 sizeMB = os.path.getsize(fileName)/1024./1024.
205 print(' %.1f MB in %.2f sec (%.1f MB/sec)' % (sizeMB, t, sizeMB/t))
206
207
208def attemptDownload(urlString, fileName):

Callers 1

download_keysFunction · 0.90

Calls 4

attemptDownloadFunction · 0.85
existsMethod · 0.65
timeMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…