-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInputParser.py
64 lines (44 loc) · 1.98 KB
/
InputParser.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
import sys
import json
from collections import defaultdict
class parseInput:
def __init__(self,fileloc):
with open(fileloc) as runSet:
self.params=json.load(runSet)
def numRuns(self):
if 'numRuns' in self.params['wrap'].keys():
return self.params['wrap']['numRuns']
return 1
def specified_settings(self):
return self.params['wrap']['settings']
def db(self):
return self.params['wrap']['database']
def runConf(self):
return [self.params['wrap']['runConf']['num_sessions'],self.params['wrap']['runConf']['timeout'] if 'timeout' in self.params['wrap']['runConf'].keys() else None]
def printer(self):
return self.params['wrap']['printer']
def queries(self):
return self.params['wrap']['queries']
def rollBack(self):
return (self.params['wrap']['enableRollBack'].lower()=='true')
def base_version(self):
return self.params['wrap']['base_version']
def conn_str(self):
return self.params['wrap']['connection_url']
def rollBack_service(self):
return self.params['wrap']['rollBackService']
def clusterInfo(self):
return [self.params['wrap']['cluster']['host'],self.params['wrap']['cluster']['clustername'],self.params['wrap']['cluster']['user'],self.params['wrap']['cluster']['password']]
def hiveDirs(self):
return [self.params['wrap']['cluster']['queryDir'],self.params['wrap']['cluster']['initDir'] if 'initDir' in self.params['wrap']['cluster'].keys() else None]
def whetherZeppelin(self):
return (self.params['wrap']['zeppelin'].lower()=='true')
def noteInfo(self):
return [self.params['wrap']['notebook']['host'],self.params['wrap']['notebook']['user'],self.params['wrap']['notebook']['password']]
def collectors(self):
c=defaultdict(lambda:defaultdict(lambda:None))
for key in self.params['wrap']['ambariMetrics']['collector'].keys():
c[key].update(self.params['wrap']['ambariMetrics']['collector'][key])
return c
def ametrics(self):
return [self.params['wrap']['ambariMetrics']['metricsHost'],self.params['wrap']['ambariMetrics']['metricsPort']]