-
Notifications
You must be signed in to change notification settings - Fork 16
/
run_grapher.py
42 lines (32 loc) · 1.02 KB
/
run_grapher.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
'''
Authors:
Carl Anderson ([email protected])
'''
import argparse
import logging
import os
import json
from lkmltools.grapher.lookml_grapher import LookMlGrapher
def parse_arguments():
"""Parse command line arguments
Returns: argument objects with flags as attributes
"""
parser = argparse.ArgumentParser()
parser.add_argument('--config',
help='Location of the configuration file',
required=True)
known_args, pipeline_args = parser.parse_known_args()
return known_args, pipeline_args
def main():
"""
"""
logging.basicConfig(format='%(asctime)s %(levelname)s %(filename)s %(funcName)s: %(message)s', level=logging.INFO)
args, _ = parse_arguments()
if os.path.exists(args.config):
with open(args.config, 'r') as f:
config = json.load(f)
else:
raise Exception('config file at: {} not found'.format(args.config))
LookMlGrapher(config).run()
if __name__ == '__main__':
main()