-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwirc_postproc_cli.py
More file actions
52 lines (44 loc) · 1.24 KB
/
wirc_postproc_cli.py
File metadata and controls
52 lines (44 loc) · 1.24 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
#!/usr/bin/python3
# -*- coding:utf-8 -*-
import click
import pathlib
import src.core as core
global workflow_configs
@click.command()
@click.option(
"--row",
default=1,
prompt="Execute row",
help="Row number used to select workflow YAML file.",
)
def run_command(row):
""" """
global workflow_configs
if (row <= 0) or (row > len(workflow_configs)):
print("\n\nERROR: Wrong value. Please try again.\n\n")
return
#
engine = core.WorkflowEngine(logger_name=core.logger_name)
engine.run_startup(workflow_configs[row - 1])
def main():
# async def main():
global workflow_configs
workflow_configs = []
for file_path in pathlib.Path(".").glob("workflow_*.yaml"):
workflow_configs.append(str(file_path))
workflow_configs = sorted(workflow_configs)
# Print before command.
print("\n")
print("WIRC Post Processing")
print("--------------------")
print("Select configuration file")
print("by entering line number.")
print("Ctrl-C to terminate.\n")
for index, row in enumerate(workflow_configs):
print(index + 1, " ", row)
print("\n")
# Execute command.
run_command()
if __name__ == "__main__":
main()
# asyncio.run(main())