def main(): global message content = "" f = open("../resource/template.html") line = f.readline() while line: content = content + line line = f.readline() f.close() options = read_args() zc = ZkClient(options.zserver, options.zport) my_topology_list = zc.get_children("/") for single_topo in my_topology_list: api = crawlUrl + "/api/v1/topology/" + single_topo + "?sys=false" read = urllib.urlopen(api).read() storm_ui_data = json.loads(read) if not re.search("walle",single_topo): continue consumer_partition = "/" + single_topo + "/partition_0" print "consumer_partition" + consumer_partition tuple = zc.get_node(consumer_partition)[0] j = json.loads(tuple) toponame = j['topology']['name'] try: zk_data = process(zc.spouts(consumer_partition, toponame),storm_ui_data) except ZkError, e: print 'Failed to access Zookeeper: %s' % str(e) return 1 except ProcessorError, e: print 'Failed to process: %s' % str(e) return 1