Check Google DNS for is_online() (#10095)
This commit is contained in:
parent
03badaff57
commit
c54b013188
2 changed files with 4 additions and 3 deletions
2
.github/workflows/ci.yaml
vendored
2
.github/workflows/ci.yaml
vendored
|
|
@ -126,7 +126,7 @@ jobs:
|
|||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/yolov8s-worldv2.pt' imgsz=160 verbose=0.318
|
||||
- name: Benchmark SegmentationModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-seg.pt' imgsz=160 verbose=0.280
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-seg.pt' imgsz=160 verbose=0.279
|
||||
- name: Benchmark PoseModel
|
||||
shell: bash
|
||||
run: coverage run -a --source=ultralytics -m ultralytics.cfg.__init__ benchmark model='path with spaces/${{ matrix.model }}-pose.pt' imgsz=160 verbose=0.183
|
||||
|
|
|
|||
|
|
@ -512,7 +512,8 @@ def is_online() -> bool:
|
|||
assert str(os.getenv("YOLO_OFFLINE", "")).lower() != "true" # check if ENV var YOLO_OFFLINE="True"
|
||||
import socket
|
||||
|
||||
socket.create_connection(address=("1.1.1.1", 80), timeout=1.0).close() # check Cloudflare DNS
|
||||
for dns in ("1.1.1.1", "8.8.8.8"): # check Cloudflare and Google DNS
|
||||
socket.create_connection(address=(dns, 80), timeout=1.0).close()
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue