Fix TQDM upload/download reporting, remove warning

This commit is contained in:
clearml 2025-04-25 16:13:58 +03:00
parent 960165d425
commit 1a2d4749ad
2 changed files with 7 additions and 3 deletions

View File

@ -119,7 +119,10 @@ class ProgressReport(object):
if _tqdm: if _tqdm:
# make sure we do not spill over due to rounding # make sure we do not spill over due to rounding
if round(float(current_mb), 2) >= _tqdm.total: if round(float(current_mb), 2) >= _tqdm.total:
_tqdm.update(_tqdm.total - self.last_reported) _tqdm.update(
max(min(
_tqdm.total - getattr(_tqdm, "n", self.last_reported), _tqdm.total - self.last_reported),
0))
else: else:
_tqdm.update(current_mb - self.last_reported) _tqdm.update(current_mb - self.last_reported)
else: else:
@ -156,7 +159,7 @@ class UploadProgressReport(ProgressReport):
log, log,
report_chunk_size_mb, report_chunk_size_mb,
description_prefix="Uploading", description_prefix="Uploading",
description_suffix="to {}".format(filename), description_suffix="from {}".format(filename),
report_start=report_start, report_start=report_start,
) )
self._filename = filename self._filename = filename

View File

@ -325,7 +325,8 @@ class _HttpDriver(_Driver):
res = container.session.post(url, data=m, timeout=timeout, headers=headers) res = container.session.post(url, data=m, timeout=timeout, headers=headers)
if res.status_code != requests.codes.ok: if res.status_code != requests.codes.ok:
raise ValueError("Failed uploading object %s (%d): %s" % (object_name, res.status_code, res.text)) raise ValueError("Failed uploading object {} to {} ({}): {}".format(
object_name, url, res.status_code, res.text))
# call back is useless because we are not calling it while uploading... # call back is useless because we are not calling it while uploading...
return res return res