Skip to content

Commit 453e66a

Browse files
authored
force build monitor (#1074)
* add random example execution to run_example script * add a scheduled workflow to force build a random example * fix cron syntax * fix YAML format for job * turn off automount during tests * remove old test for text-to-pokemon naming * turn off automounting during tests * ignore two examples that end with _test.py
1 parent 007a3d2 commit 453e66a

File tree

6 files changed

+57
-42
lines changed

6 files changed

+57
-42
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Force build
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "23 * * * *"
7+
8+
env:
9+
TERM: linux
10+
TERMINFO: /etc/terminfo
11+
MODAL_TOKEN_ID: ${{ secrets.MODAL_MODAL_LABS_TOKEN_ID }}
12+
MODAL_TOKEN_SECRET: ${{ secrets.MODAL_MODAL_LABS_TOKEN_SECRET }}
13+
MODAL_ENVIRONMENT: examples
14+
15+
jobs:
16+
build-and-run:
17+
name: Build a random example from scratch and run it
18+
runs-on: ubuntu-24.04
19+
timeout-minutes: 60
20+
steps:
21+
- name: Checkout Repository
22+
uses: actions/checkout@v3
23+
with:
24+
fetch-depth: 1
25+
- uses: ./.github/actions/setup
26+
27+
- name: Run a random example with MODAL_FORCE_BUILD set
28+
run: |
29+
MODAL_FORCE_BUILD=1 python3 -m internal.run_example

06_gpu_and_ml/text-to-pokemon/tests/pokemon_naming_test.py

Lines changed: 0 additions & 39 deletions
This file was deleted.

internal/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pytest
2+
3+
4+
@pytest.fixture(autouse=True)
5+
def disable_auto_mount(monkeypatch):
6+
monkeypatch.setenv("MODAL_AUTOMOUNT", "0")
7+
yield

internal/examples_test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
example_ids = [ex.module for ex in examples]
1818

1919

20+
@pytest.fixture(autouse=True)
21+
def disable_auto_mount(monkeypatch):
22+
monkeypatch.setenv("MODAL_AUTOMOUNT", "0")
23+
yield
24+
25+
2026
@pytest.fixture(autouse=False)
2127
def add_root_to_syspath(monkeypatch):
2228
sys.path.append(str(EXAMPLES_ROOT))

internal/run_example.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import random
23
import subprocess
34
import sys
45
import time
@@ -46,5 +47,17 @@ def run_single_example(stem):
4647
return 0
4748

4849

50+
def run_random_example():
51+
examples = filter(
52+
lambda ex: ex.metadata and ex.metadata.get("lambda-test", True),
53+
utils.get_examples(),
54+
)
55+
run_script(random.choice(list(examples)))
56+
return 0
57+
58+
4959
if __name__ == "__main__":
50-
sys.exit(run_single_example(sys.argv[1]))
60+
if len(sys.argv) > 1:
61+
sys.exit(run_single_example(sys.argv[1]))
62+
else:
63+
sys.exit(run_random_example())

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ filterwarnings = [
44
"error::modal.exception.DeprecationError",
55
"ignore::DeprecationWarning:pytest.*:",
66
]
7-
pythonpath = ["06_gpu_and_ml/spam-detect", "06_gpu_and_ml/text-to-pokemon"]
8-
7+
addopts = "--ignore 06_gpu_and_ml/llm-serving/openai_compatible/load_test.py --ignore 07_web_endpoints/fasthtml-checkboxes/cbx_load_test.py"
98

109
[tool.mypy]
1110
ignore_missing_imports = true

0 commit comments

Comments
 (0)