-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrun.py
More file actions
29 lines (20 loc) · 1017 Bytes
/
run.py
File metadata and controls
29 lines (20 loc) · 1017 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# This script acts as an entrypoint and is used to setup, manage and run conda environments.
import sys
from pathlib import Path
from validator import conda
ENV_NAME_PREFIX = "flock-validation-"
def entrypoint():
repo_path = Path(__file__).resolve().parent.parent
# is_latest_version(str(repo_path))
module = sys.argv[1]
# Check if the module directory exists
base_requirements_file = Path(__file__).parent / "requirements.txt"
module_environment_file = Path(__file__).parent / "validator" / "modules" / module / "environment.yml"
if not module_environment_file.exists():
raise ValueError(f"Module {module} does not exist")
# Check if the environment exists
env_name = ENV_NAME_PREFIX + module
# Run the module, passing through all the arguments
conda.ensure_env_and_run(env_name, module_environment_file, base_requirements_file, ["--no-capture-output", "python", "environment_entrypoint.py", *sys.argv[1:]])
if __name__ == "__main__":
entrypoint()