Retry check_requirements once on failure (#9466)
This commit is contained in:
parent
5268ca14eb
commit
80c59e2461
1 changed files with 3 additions and 1 deletions
|
|
@ -28,6 +28,7 @@ from ultralytics.utils import (
|
||||||
ONLINE,
|
ONLINE,
|
||||||
ROOT,
|
ROOT,
|
||||||
USER_CONFIG_DIR,
|
USER_CONFIG_DIR,
|
||||||
|
Retry,
|
||||||
SimpleNamespace,
|
SimpleNamespace,
|
||||||
ThreadingLocked,
|
ThreadingLocked,
|
||||||
TryExcept,
|
TryExcept,
|
||||||
|
|
@ -390,7 +391,8 @@ def check_requirements(requirements=ROOT.parent / "requirements.txt", exclude=()
|
||||||
try:
|
try:
|
||||||
t = time.time()
|
t = time.time()
|
||||||
assert is_online(), "AutoUpdate skipped (offline)"
|
assert is_online(), "AutoUpdate skipped (offline)"
|
||||||
LOGGER.info(subprocess.check_output(f"pip install --no-cache {s} {cmds}", shell=True).decode())
|
with Retry(times=1, delay=1): # retry once on failure after 1 second
|
||||||
|
LOGGER.info(subprocess.check_output(f"pip install --no-cache {s} {cmds}", shell=True).decode())
|
||||||
dt = time.time() - t
|
dt = time.time() - t
|
||||||
LOGGER.info(
|
LOGGER.info(
|
||||||
f"{prefix} AutoUpdate success ✅ {dt:.1f}s, installed {n} package{'s' * (n > 1)}: {pkgs}\n"
|
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