-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathruleflow.py
More file actions
60 lines (49 loc) · 1.33 KB
/
ruleflow.py
File metadata and controls
60 lines (49 loc) · 1.33 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import subprocess
from pathlib import Path
import argparse
BASE_DIR = Path(__file__).resolve().parent
def run_snippetGen():
snippetGenDir = BASE_DIR / "snippetgen"
subprocess.run(
["./docker_run.sh"],
cwd=snippetGenDir, check=True)
subprocess.run(
["python3","postprocessing.py"],
cwd=snippetGenDir, check=True)
def run_rulegen():
ruleGenDir = BASE_DIR / "rulegen"
subprocess.run(
["rulegenenv/bin/python3", "rulegen.py"],
cwd=ruleGenDir, check=True)
subprocess.run(
["rulegenenv/bin/python3","rulegenToCodeGen.py"],
cwd=ruleGenDir, check=True)
def run_codegen():
codeGenDir = BASE_DIR / "codegen"
subprocess.run(
["codegenenv/bin/python3", "codegen.py"],
cwd=codeGenDir, check=True)
def run_all():
run_snippetGen()
run_rulegen()
run_codegen()
def main():
parser = argparse.ArgumentParser(
description="Run RuleFlow"
)
parser.add_argument(
"stage",
choices=["all", "snippetgen", "rulegen", "codegen"],
help="Which stage to run"
)
args = parser.parse_args()
if args.stage == "all":
run_all()
elif args.stage == "snippetgen":
run_snippetGen()
elif args.stage == "rulegen":
run_rulegen()
elif args.stage == "codegen":
run_codegen()
if __name__ == "__main__":
main()