MCPcopy Create free account
hub / github.com/baidu/tera / config

Function config

example/docker/cluster_setup.py:37–67  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

35 return args
36
37def config(args):
38 config = {}
39 if args.conf is None:
40 local_ip = socket.gethostbyname(socket.gethostname())
41 log = os.path.expanduser('~')
42 config.update({"hdfs":1, "ip":local_ip, "tera":1, "zk":1, "log_prefix":log})
43 else:
44 config = json.load(open(args.conf, 'r'))
45 ip_list = config['ip'].split(':')
46 if config.has_key('log_prefix'):
47 log_prefix = config['log_prefix']
48 else:
49 log_prefix = os.path.expanduser('~')
50 zk_cluster = zk.ZkCluster(ip_list, config['zk'], log_prefix)
51 zk_cluster.populate_zk_cluster()
52 for z in zk_cluster.cluster:
53 print z.to_string()
54
55 hdfs_cluster = hdfs.HdfsCluster(ip_list, config['hdfs'], log_prefix)
56 ret = hdfs_cluster.populate_hdfs_cluster()
57 if ret is False:
58 exit(1)
59 for h in hdfs_cluster.cluster:
60 print h.to_string()
61
62 tera_cluster = tera.TeraCluster(ip_list, config['tera'], log_prefix)
63 tera_cluster.populate_tera_cluster()
64 for t in tera_cluster.cluster:
65 print t.to_string()
66
67 return zk_cluster, hdfs_cluster, tera_cluster
68
69def start_zk(args, zk_cluster, s):
70 if (args.hdfs or args.tera) and not args.zk:

Callers 1

mainFunction · 0.70

Calls 5

populate_zk_clusterMethod · 0.95
populate_hdfs_clusterMethod · 0.95
populate_tera_clusterMethod · 0.95
updateMethod · 0.80
to_stringMethod · 0.45

Tested by

no test coverage detected