def list_resources(fabric): try: pinot_fabric = PinotFabric(config, logger, fabric) except PinotException as e: return jsonify( dict(success=False, error_message='Failed getting fabric {0}'.format(e))) try: resources = pinot_fabric.get_resources() except PinotException as e: return jsonify( dict(success=False, error_message='Failed getting fabric: {0}'.format(e))) try: zk = PinotZk(config, logger, fabric) except PinotException as e: return jsonify( dict(success=False, error_message='Failed getting ZK: {0}'.format(e))) return jsonify( dict(success=True, clusters=resources, nodes=pinot_fabric.get_nodes(zk.get_handle())))
def list_resources(fabric): try: pinot_fabric = PinotFabric(config, logger, fabric) except PinotException as e: return jsonify(dict(success=False, error_message='Failed getting fabric {0}'.format(e))) try: resources = pinot_fabric.get_resources() except PinotException as e: return jsonify(dict(success=False, error_message='Failed getting fabric: {0}'.format(e))) try: zk = PinotZk(config, logger, fabric) except PinotException as e: return jsonify(dict(success=False, error_message='Failed getting ZK: {0}'.format(e))) return jsonify(dict(success=True, clusters=resources, nodes=pinot_fabric.get_nodes(zk.get_handle())))
def get_nodes(self, zk): nodes_status = defaultdict(dict) pinot_fabric = PinotFabric(self.config, self.logger, self.fabric) for node in pinot_fabric.get_nodes(zk): match = False for tag in node['tags']: if tag.startswith(self.resource): match = True break if not match: continue instance_path = os.path.join(self.config.get_zk_root(self.fabric), 'LIVEINSTANCES', node['nodename']) host = node['host'] nodes_status[host]['type'] = node['type'] nodes_status[host]['helix_port'] = 0 nodes_status[host]['online'] = zk.exists(instance_path) return nodes_status