-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (30 loc) · 1.49 KB
/
main.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
29
30
31
32
33
34
import argparse
import time
from modules.workflow import auto_execute, show_reports, check_reports, generate_reports
def main():
parser = argparse.ArgumentParser(description="Workflow Automation Tool")
parser.add_argument('--auto', action='store_true', help='Automatically execute workflows from YAML schedule')
parser.add_argument('--show', nargs='?', const=10, help='Show available report IDs (default: 10, or specify "all")')
parser.add_argument('--check', nargs=3, metavar=('report_id1', 'report_id2', 'receiver_email'),
help='Manually execute workflow include force generating with specified report IDs and receiver email (no host domain name)')
parser.add_argument('--gen', nargs=2, metavar=('report_id1', 'report_id2'),
help='Trigger report generation for specified report IDs')
args = parser.parse_args()
if args.auto:
auto_execute()
elif args.show:
limit = args.show if args.show == 'all' else int(args.show)
show_reports(limit)
elif args.check:
report_id1, report_id2, receiver_email = args.check
generate_reports(report_id1, report_id2)
#wait for gen report to be finished
time.sleep(300)
check_reports(report_id1, report_id2, receiver_email)
elif args.gen:
report_id1, report_id2 = args.gen
generate_reports(report_id1, report_id2)
else:
parser.print_help()
if __name__ == "__main__":
main()