-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
74 lines (50 loc) · 2.36 KB
/
main.py
File metadata and controls
74 lines (50 loc) · 2.36 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/env python
import sys
import os
import argparse
import datetime
from generic import setup_cleanup_on_exit, callback_on_exit
from generic.config import set_active_config
from generic.config_logging import init_logging
##########################################################################################################
def main():
parser = argparse.ArgumentParser(
description='??')
parser.add_argument(
'--target_env', metavar='target_env', type=str,
help='target environment (TEST/PROD)')
parser.add_argument("--static_data", nargs='?', type=bool,
const=True, default=False)
args = parser.parse_args()
active_config = set_active_config(args.target_env, get_app_name())
logging = init_logging(active_config)
logging.info('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
logging.info('>> ??? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
logging.info('')
logging.info('<< ??? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
logging.info('>> ??? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
logging.info('')
logging.info('<< ??? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
logging.info('>> ??? >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>')
logging.info('')
logging.info('<< ??? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
logging.info('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
##########################################################################################################
def get_app_name():
return os.path.splitext(os.path.basename(__file__))[0]
##########################################################################################################
if __name__ == '__main__':
start_time = datetime.datetime.now()
sys.__stdout__.write('%s \n' % start_time.ctime())
sys.__stdout__.flush()
try:
setup_cleanup_on_exit()
main()
except KeyboardInterrupt:
# Handle Ctrl+C gracefully
print("KeyboardInterrupt received, exiting...")
callback_on_exit()
end_time = datetime.datetime.now()
sys.__stdout__.write('%s \n' % end_time.ctime())
sys.__stdout__.write('TOTAL DURATION = %s \n' % (end_time - start_time))
sys.__stdout__.flush()