-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
150 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
llm: (magic global install max-pipelines && magic global update max-pipelines) || true; MAX_SERVE_PORT=8000 MAX_SERVE_HOST=127.0.0.1 HUGGING_FACE_HUB_TOKEN=$(cat .env | grep HUGGING_FACE_HUB_TOKEN | cut -d '=' -f2) && max-pipelines serve --huggingface-repo-id sentence-transformers/all-mpnet-base-v2 | ||
main: magic run python main.py | ||
llm: for i in $(seq 1 3); do (magic global install max-pipelines && magic global update max-pipelines) || true; MAX_SERVE_PORT=8000 MAX_SERVE_HOST=127.0.0.1 HUGGING_FACE_HUB_TOKEN=$(cat .env | grep HUGGING_FACE_HUB_TOKEN | cut -d '=' -f2) && max-pipelines serve --huggingface-repo-id sentence-transformers/all-mpnet-base-v2 && break || (echo "Attempt $i failed, retrying..." && sleep 5); done | ||
main: magic run python main.py && kill -2 $(pgrep -f "max-pipelines serve") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import sys | ||
import os | ||
import subprocess | ||
from pathlib import Path | ||
|
||
|
||
def run_tests_for_directory(directory: str) -> bool: | ||
""" | ||
Run tests for a specific directory. | ||
Returns True if all tests pass, False otherwise. | ||
""" | ||
print(f"Running tests for {directory}...") | ||
original_dir = os.getcwd() | ||
os.chdir(directory) | ||
|
||
# Check for project file in order of preference after changing directory | ||
project_files = ["pixi.toml", "pyproject.toml", "mojoproject.toml"] | ||
project_file = next((f for f in project_files if Path(f).exists()), None) | ||
|
||
if project_file: | ||
print("PIXI_PROJECT_MANIFEST: ", str(Path(project_file).absolute())) | ||
os.environ["PIXI_PROJECT_MANIFEST"] = str(Path(project_file).absolute()) | ||
|
||
try: | ||
subprocess.run(["magic", "run", "test"], check=True) | ||
success = True | ||
except subprocess.CalledProcessError as e: | ||
print(f"Test failed: {e}") | ||
success = False | ||
|
||
os.chdir(original_dir) | ||
return success | ||
|
||
|
||
def main(): | ||
if len(sys.argv) < 2 or not sys.argv[1]: | ||
directories = [ | ||
d | ||
for d in os.listdir() | ||
if os.path.isdir(d) and d not in [".git", "scripts", ".github", ".magic"] | ||
] | ||
else: | ||
directories = sys.argv[1:] | ||
|
||
print(f"Testing directories: {directories}") | ||
failed = False | ||
|
||
for directory in directories: | ||
if not run_tests_for_directory(directory): | ||
failed = True | ||
|
||
sys.exit(1 if failed else 0) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |