From 0dc286ff8fd3b830143f2dad911cf91b1e438c3f Mon Sep 17 00:00:00 2001 From: discountchubbs Date: Tue, 8 Sep 2026 19:49:42 -0700 Subject: [PATCH] =?UTF-8?q?loop=20in=20the=20=F0=9F=8C=B0=20(start=20with?= =?UTF-8?q?=20one=20random=20sample=20to=20see=20what=20gh=20action=20says?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test_models.yml | 31 ++++++++++++++++--- .../sunnypilot/modeld_v2/tests/test_models.py | 2 ++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test_models.yml b/.github/workflows/test_models.yml index 1f9be0a8a1..322649ae59 100644 --- a/.github/workflows/test_models.yml +++ b/.github/workflows/test_models.yml @@ -19,14 +19,16 @@ jobs: id: set-matrix run: | python3 -c ' - import json, urllib.request, sys, os, re + import json, urllib.request, sys, os, re, random with open("openpilot/sunnypilot/models/fetcher.py", "r") as f: content = f.read() match = re.search(r"MODEL_URL\s*=\s*[\"'"'"']([^\"'"'"']+)[\"'"'"']", content) + match_chestnut = re.search(r"MODEL_URL_CHESTNUT\s*=\s*[\"'"'"']([^\"'"'"']+)[\"'"'"']", content) if not match: raise ValueError("MODEL_URL not found in fetcher.py") url = match.group(1) + chestnut_url = match_chestnut.group(1) if match_chestnut else None req = urllib.request.urlopen(url) data = json.loads(req.read()) @@ -37,6 +39,21 @@ jobs: if "artifact" in model: artifacts.append(model["artifact"]) + if chestnut_url: + try: + req_chestnut = urllib.request.urlopen(chestnut_url) + data_chestnut = json.loads(req_chestnut.read()) + chestnut_artifacts = [ + m["artifact"] + for b in data_chestnut.get("bundles", []) + for m in b.get("models", []) + if "artifact" in m + ] + if chestnut_artifacts: + artifacts.append(random.choice(chestnut_artifacts)) + except Exception as e: + print(f"Failed to fetch Chestnut models: {e}", file=sys.stderr) + with open(os.environ["GITHUB_OUTPUT"], "a") as f: f.write(f"models={json.dumps(artifacts)}\n") ' @@ -61,7 +78,7 @@ jobs: echo '${{ toJson(matrix.artifact.chunks) }}' > chunks.json BASE_URL="${{ matrix.artifact.download_uri.url }}" - BASE_DIR=$(dirname "$BASE_URL") + export BASE_DIR=$(dirname "$BASE_URL") python3 -c ' import json, os @@ -70,9 +87,13 @@ jobs: manifest_path = f"/tmp/model_chunks/${{ matrix.artifact.file_name }}.chunkmanifest" with open(manifest_path, "w") as f: f.write(str(len(chunks))) - for c in chunks: - print(c["file_name"]) - ' | xargs -I {} -P 10 bash -c "echo 'Downloading {}...' && curl -f -s -S -L -o '/tmp/model_chunks/{}' \"$BASE_DIR/{}\"" + base_dir = os.environ["BASE_DIR"] + with open("/tmp/curl_config.txt", "w") as f: + for c in chunks: + fn = c["file_name"] + f.write(f"url = \"{base_dir}/{fn}\"\noutput = \"/tmp/model_chunks/{fn}\"\n") + ' + curl -Z --parallel-immediate --parallel-max 16 -s -S -f -L -K /tmp/curl_config.txt - name: Run Model Compatibility Test env: diff --git a/openpilot/sunnypilot/modeld_v2/tests/test_models.py b/openpilot/sunnypilot/modeld_v2/tests/test_models.py index c31c4c818a..aaa79679c2 100644 --- a/openpilot/sunnypilot/modeld_v2/tests/test_models.py +++ b/openpilot/sunnypilot/modeld_v2/tests/test_models.py @@ -25,6 +25,8 @@ class TestLegacyModels(unittest.TestCase): def safe_getitem(device_self, ix): if ix == "QCOM" and not os.path.exists("/dev/kgsl-3d0"): return real_getitem(device_self, "CPU") + if ix == "AMD" and not os.path.exists("/dev/kfd"): + return real_getitem(device_self, "CPU") return real_getitem(device_self, ix) with patch.object(Device.__class__, "__getitem__", safe_getitem):