forked from e-p-armstrong/augmentoolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_augmentoolkit.py
28 lines (23 loc) · 1.12 KB
/
run_augmentoolkit.py
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
print("Augmentoolkit is starting to run! If this is your first time running this it might take a few moments to start due to imports and such.")
# Named "run_augmentoolkit" so that you can type "run" and tab instead of typing "augmentoolkit" and having it clash with the folder we import stuff from.
# Orchestrate and execute pipelines according to the super-config in order.
import subprocess
import os
import yaml
with open("super_config.yaml", "r") as f:
super_config = yaml.safe_load(f)
def run_processing_script(folder_path, config_path, project_root):
env = os.environ.copy()
env["PYTHONPATH"] = project_root
env["CONFIG_PATH"] = config_path
env["FOLDER_PATH"] = folder_path
subprocess.run(["python", "processing.py"], cwd=folder_path, env=env)
def main():
project_root = os.path.dirname(os.path.abspath(__file__))
folder_configs = super_config["pipeline_order"]
for folder_config in folder_configs:
folder_path = folder_config["folder"]
config_path = folder_config["config"]
run_processing_script(folder_path, config_path, project_root)
if __name__ == "__main__":
main()