forked from daviguima/get-pak-rebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
66 lines (56 loc) · 1.83 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
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
import time
import argparse
import getpak
from getpak.commons import Utils as U
from getpak import automation as A
"""
Author: David Guimaraes - [email protected]
"""
# ,-------------,
# | ENTRY POINT |
# '-------------'
if __name__ == '__main__':
# ,--------------,
# | Start timers |
# '--------------'
U.tic()
t1 = time.perf_counter()
# ,------,
# | LOGO |
# '------'
U.print_logo()
# ,-----------------,
# | Present options |
# '-----------------'
parser = argparse.ArgumentParser()
parser.add_argument('-v', '--version', help='Displays current package version.', action='store_true')
parser.add_argument('-mg', help="Given a path, return GRS metadata", default='local', type=str)
args = parser.parse_args().__dict__ # Converts the input arguments from Namespace() to dict
print('User Input Arguments:')
for key in args:
print(f'{key}: {args[key]}')
# ,----------------------------------------,
# | Automation pipelines class declaration |
# '----------------------------------------'
gpk_pipe = A.Pipelines()
# ,---------------,
# | Treat options |
# '---------------'
if args['version']:
print(f'GET-Pak version: {getpak.__version__}')
elif args['mg']:
gpk_pipe.get_grs_metadict(args['mg'])
else:
print('No commands supplied, exiting.\n')
# ,------------------------------,
# | End timers and report to log |
# '------------------------------'
t_hour, t_min, t_sec, _ = U.tac()
t2 = time.perf_counter()
final_msg_1 = f'Finished in {round(t2 - t1, 2)} second(s).'
final_msg_2 = f'Elapsed execution time: {t_hour}h : {t_min}m : {t_sec}s'
print(final_msg_1)
print(final_msg_2)
# ,-----,
# | END |
# '-----'