Abandon with Retry(): context manager (#13159)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
22de23ec8d
commit
25c9f77c8f
3 changed files with 4 additions and 27 deletions
|
|
@ -33,7 +33,6 @@ from ultralytics.utils import (
|
|||
ROOT,
|
||||
TORCHVISION_VERSION,
|
||||
USER_CONFIG_DIR,
|
||||
Retry,
|
||||
SimpleNamespace,
|
||||
ThreadingLocked,
|
||||
TryExcept,
|
||||
|
|
@ -390,8 +389,7 @@ def check_requirements(requirements=ROOT.parent / "requirements.txt", exclude=()
|
|||
try:
|
||||
t = time.time()
|
||||
assert ONLINE, "AutoUpdate skipped (offline)"
|
||||
with Retry(times=2, delay=1): # run up to 2 times with 1-second retry delay
|
||||
LOGGER.info(subprocess.check_output(f"pip install --no-cache-dir {s} {cmds}", shell=True).decode())
|
||||
LOGGER.info(subprocess.check_output(f"pip install --no-cache-dir {s} {cmds}", shell=True).decode())
|
||||
dt = time.time() - t
|
||||
LOGGER.info(
|
||||
f"{prefix} AutoUpdate success ✅ {dt:.1f}s, installed {n} package{'s' * (n > 1)}: {pkgs}\n"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue