def get_container_file_data(cluster, environ, topology, container, path, offset, length, role=None): ''' :param cluster: :param environ: :param topology: :param container: :param path: :param offset: :param length: :param role: :return: ''' params = dict( cluster=cluster, environ=environ, topology=topology, container=container, path=path, offset=offset, length=length) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(FILE_DATA_URL_FMT), params) if role is not None: request_url = tornado.httputil.url_concat(request_url, dict(role=role)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comps(cluster, environ, topology): request_url = tornado.httputil.url_concat( create_url(lOGICALPLAN_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology)) lplan = yield fetch_url_as_json(request_url) comps = lplan['spouts'].keys() + lplan['bolts'].keys() raise tornado.gen.Return(comps)
def get_comp_instance_metrics(cluster, environ, topology, component, metrics, instances, time_range): # form the fetch url request_url = tornado.httputil.url_concat( create_url(METRICS_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology, component=component)) # convert a single instance to a list, if needed all_instances = instances if isinstance(instances, list) else [instances] # append each metric to the url for display_name, metric_name in metrics.iteritems(): request_url = tornado.httputil.url_concat( request_url, dict(metricname=metric_name[0])) # append each instance to the url for i in all_instances: request_url = tornado.httputil.url_concat(request_url, dict(instance=i)) # append the time interval to the url request_url = tornado.httputil.url_concat(request_url, dict(interval=time_range[1])) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_instance_mem_histogram(cluster, environ, topology, instance, role=None): ''' :param cluster: :param environ: :param topology: :param instance: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology, instance=instance) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(HISTOGRAM_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def run_instance_jmap(cluster, environ, topology, instance, role=None): ''' :param cluster: :param environ: :param topology: :param instance: :param role: :return: ''' params = dict( cluster=cluster, environ=environ, topology=topology, instance=instance) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(JMAP_URL_FMT), params) if role is not None: request_url = tornado.httputil.url_concat(request_url, dict(role=role)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_topologies(): ''' Get the list of topologies given a data center from heron tracker :return: ''' request_url = create_url(TOPOLOGIES_URL_FMT) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comp_metrics_timeline( cluster, environ, topology, component, instances, metricnames, time_range): # form the url request_url = tornado.httputil.url_concat( create_url(METRICS_TIMELINE_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology, component = component) ) # append each metric to the url for metric_name in metricnames: request_url = tornado.httputil.url_concat(request_url, dict(metricname=metric_name)) # append each instance to the url for instance in instances: request_url = tornado.httputil.url_concat(request_url, dict(instance=instance)) # append the time interval to the url request_url = tornado.httputil.url_concat(request_url, dict(starttime=time_range[0], endtime=time_range[1])) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comp_instance_metrics( cluster, environ, topology, component, metrics, instances, time_range): # form the fetch url request_url = tornado.httputil.url_concat( create_url(METRICS_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology, component = component) ) # convert a single instance to a list, if needed all_instances = instances if isinstance(instances, list) else [instances] # append each metric to the url for display_name, metric_name in metrics.iteritems(): request_url = tornado.httputil.url_concat( request_url, dict(metricname=metric_name[0]) ) # append each instance to the url for i in all_instances: request_url = tornado.httputil.url_concat(request_url, dict(instance=i)) # append the time interval to the url request_url = tornado.httputil.url_concat( request_url, dict(interval=time_range[1]) ) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_metrics(cluster, environment, topology, timerange, query, role=None): ''' Get the metrics for a topology from tracker :param cluster: :param environment: :param topology: :param timerange: :param query: :param role: :return: ''' params = dict( cluster=cluster, environ=environment, topology=topology, starttime=timerange[0], endtime=timerange[1], query=query) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(METRICS_QUERY_URL_FMT), params ) logging.info("get_metrics %s", request_url) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_metrics(cluster, environment, topology, timerange, query, role=None): ''' Get the metrics for a topology from tracker :param cluster: :param environment: :param topology: :param timerange: :param query: :param role: :return: ''' params = dict(cluster=cluster, environ=environment, topology=topology, starttime=timerange[0], endtime=timerange[1], query=query) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(METRICS_QUERY_URL_FMT), params) logging.info("get_metrics %s", request_url) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comp_metrics( cluster, environ, topology, component, instances, metricnames, time_range, role=None): params = dict( cluster=cluster, environ=environ, topology=topology, component=component) if role is not None: params['role'] = role # form the url request_url = tornado.httputil.url_concat( create_url(METRICS_URL_FMT), params) # append each metric to the url for metric_name in metricnames: request_url = tornado.httputil.url_concat( request_url, dict(metricname=metric_name)) # append each instance to the url for instance in instances: request_url = tornado.httputil.url_concat( request_url, dict(instance=instance)) # append the time interval to the url request_url = tornado.httputil.url_concat( request_url, dict(interval=time_range[1])) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_scheduler_location(cluster, environ, topology, role=None): params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(SCHEDULER_LOCATION_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_topologies_states(): ''' Get the list of topologies and their states :return: ''' request_url = create_url(TOPOLOGIES_STATS_URL_FMT) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comp_metrics_timeline(cluster, environ, topology, component, instances, metricnames, time_range): # form the url request_url = tornado.httputil.url_concat( create_url(METRICS_TIMELINE_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology, component=component)) # append each metric to the url for metric_name in metricnames: request_url = tornado.httputil.url_concat(request_url, dict(metricname=metric_name)) # append each instance to the url for instance in instances: request_url = tornado.httputil.url_concat(request_url, dict(instance=instance)) # append the time interval to the url request_url = tornado.httputil.url_concat( request_url, dict(starttime=time_range[0], endtime=time_range[1])) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_physical_plan(cluster, environ, topology, role=None): params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(PHYSICALPLAN_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_execution_state(cluster, environ, topology, role=None): params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(EXECUTION_STATE_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_topologies_states(): ''' Get the list of topologies and their states :return: ''' request_url = create_url(TOPOLOGIES_URL_FMT) + "/states" raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def run_instance_jmap(cluster, environ, topology, instance): request_url = tornado.httputil.url_concat( create_url(JMAP_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology, instance=instance)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_instance_mem_histogram(cluster, environ, topology, instance): request_url = tornado.httputil.url_concat( create_url(HISTOGRAM_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology, instance=instance)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comps(cluster, environ, topology): request_url = tornado.httputil.url_concat( create_url(lOGICALPLAN_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology) ) lplan = yield fetch_url_as_json(request_url) comps = lplan['spouts'].keys() + lplan['bolts'].keys() raise tornado.gen.Return(comps)
def get_component_exceptions(cluster, environ, topology, component): request_url = tornado.httputil.url_concat( create_url(EXCEPTIONS_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology, component=component)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def _get_topologies(cluster, role=None, env=None): endpoint = create_url(TOPOLOGIES_URL_FMT) params = dict(cluster=cluster) if role is not None: params['role'] = role if env is not None: params['environ'] = env request_url = tornado.httputil.url_concat(endpoint, params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_filestats(cluster, environ, topology, container, path): request_url = tornado.httputil.url_concat( create_url(FILESTATS_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology, container=container, path=path)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comps(cluster, environ, topology, role=None): params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(lOGICALPLAN_URL_FMT), params) lplan = yield fetch_url_as_json(request_url) comps = lplan['spouts'].keys() + lplan['bolts'].keys() raise tornado.gen.Return(comps)
def run_instance_jmap(cluster, environ, topology, instance): request_url = tornado.httputil.url_concat( create_url(JMAP_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology, instance = instance) ) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_instance_mem_histogram(cluster, environ, topology, instance): request_url = tornado.httputil.url_concat( create_url(HISTOGRAM_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology, instance = instance) ) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_topology_info(cluster, environ, topology): request_url = tornado.httputil.url_concat( create_url(INFO_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology) ) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_component_exceptions(cluster, environ, topology, component): request_url = tornado.httputil.url_concat( create_url(EXCEPTIONS_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology, component = component) ) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_filestats(cluster, environ, topology, container, path): request_url = tornado.httputil.url_concat( create_url(FILESTATS_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology, container = container, path = path) ) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_metrics(cluster, environment, topology, timerange, query): request_url = tornado.httputil.url_concat( create_url(METRICS_QUERY_URL_FMT), dict(cluster=cluster, environ=environment, topology=topology, starttime=timerange[0], endtime=timerange[1], query=query)) logging.info("get_metrics %s" % (request_url)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_component_exceptions(cluster, environ, topology, component, role=None): params = dict( cluster=cluster, environ=environ, topology=topology, component=component) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(EXCEPTIONS_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_container_file_data(cluster, environ, topology, container, path, offset, length): request_url = tornado.httputil.url_concat( create_url(FILE_DATA_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology, container=container, path=path, offset=offset, length=length)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_container_file_data(cluster, environ, topology, container, path, offset, length): request_url = tornado.httputil.url_concat( create_url(FILE_DATA_URL_FMT), dict(cluster = cluster, environ = environ, topology = topology, container = container, path = path, offset = offset, length = length) ) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_metrics(cluster, environment, topology, timerange, query): request_url = tornado.httputil.url_concat( create_url(METRICS_QUERY_URL_FMT), dict(cluster = cluster, environ = environment, topology = topology, starttime = timerange[0], endtime = timerange[1], query = query) ) logging.info("get_metrics %s" % (request_url)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_instance_mem_histogram(cluster, environ, topology, instance, role=None): params = dict( cluster=cluster, environ=environ, topology=topology, instance=instance) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(HISTOGRAM_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_execution_state(cluster, environ, topology, role=None): ''' Get the execution state of a topology in a cluster :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(EXECUTION_STATE_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comp_metrics_timeline(cluster, environ, topology, component, instances, metricnames, time_range, role=None): ''' Get the minute-by-minute metrics for all instances of a topology from tracker :param cluster: :param environ: :param topology: :param component: :param instances: :param metricnames: dict of display name to cuckoo name :param time_range: 2-tuple consisting of start and end of range :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology, component=component) if role is not None: params['role'] = role # form the url request_url = tornado.httputil.url_concat( create_url(METRICS_TIMELINE_URL_FMT), params) if role is not None: request_url = tornado.httputil.url_concat(request_url, dict(role=role)) # append each metric to the url for metric_name in metricnames: request_url = tornado.httputil.url_concat(request_url, dict(metricname=metric_name)) # append each instance to the url for instance in instances: request_url = tornado.httputil.url_concat(request_url, dict(instance=instance)) # append the time interval to the url request_url = tornado.httputil.url_concat( request_url, dict(starttime=time_range[0], endtime=time_range[1])) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comp_instance_metrics(cluster, environ, topology, component, metrics, instances, time_range, role=None): ''' Get the metrics for some instances of a topology from tracker :param cluster: :param environ: :param topology: :param component: :param metrics: dict of display name to cuckoo name :param instances: :param time_range: 2-tuple consisting of start and end of range :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology, component=component) if role is not None: params['role'] = role # form the fetch url request_url = tornado.httputil.url_concat(create_url(METRICS_URL_FMT), params) # convert a single instance to a list, if needed all_instances = instances if isinstance(instances, list) else [instances] # append each metric to the url for _, metric_name in metrics.items(): request_url = tornado.httputil.url_concat( request_url, dict(metricname=metric_name[0])) # append each instance to the url for i in all_instances: request_url = tornado.httputil.url_concat(request_url, dict(instance=i)) # append the time interval to the url request_url = tornado.httputil.url_concat(request_url, dict(interval=time_range[1])) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_scheduler_location(cluster, environ, topology, role=None): ''' Get the scheduler location of a topology in a cluster from tracker :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(SCHEDULER_LOCATION_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_filestats(cluster, environ, topology, container, path, role=None): params = dict( cluster=cluster, environ=environ, topology=topology, container=container, path=path) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(FILESTATS_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_physical_plan(cluster, environ, topology, role=None): ''' Get the physical plan state of a topology in a cluster from tracker :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(PHYSICALPLAN_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_physical_plan(cluster, environ, topology, role=None): ''' Get the physical plan state of a topology in a cluster from tracker :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(PHYSICALPLAN_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_topology_info(cluster, environ, topology, role=None): ''' :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(INFO_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_instances(cluster, environ, topology, role=None): ''' Get the list of instances for the topology from Heron Nest :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(PHYSICALPLAN_URL_FMT), params) pplan = yield fetch_url_as_json(request_url) instances = pplan['instances'].keys() raise tornado.gen.Return(instances)
def get_comps(cluster, environ, topology, role=None): ''' Get the list of component names for the topology from Heron Nest :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat( create_url(LOGICALPLAN_URL_FMT), params) lplan = yield fetch_url_as_json(request_url) comps = lplan['spouts'].keys() + lplan['bolts'].keys() raise tornado.gen.Return(comps)
def get_comps(cluster, environ, topology, role=None): ''' Get the list of component names for the topology from Heron Nest :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(LOGICALPLAN_URL_FMT), params) lplan = yield fetch_url_as_json(request_url) comps = lplan['spouts'].keys() + lplan['bolts'].keys() raise tornado.gen.Return(comps)
def get_instances(cluster, environ, topology, role=None): ''' Get the list of instances for the topology from Heron Nest :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(PHYSICALPLAN_URL_FMT), params) pplan = yield fetch_url_as_json(request_url) instances = pplan['instances'].keys() raise tornado.gen.Return(instances)
def get_component_exceptions(cluster, environ, topology, component, role=None): ''' Get exceptions for 'component' for 'topology' :param cluster: :param environ: :param topology: :param component: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology, component=component) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(EXCEPTIONS_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_topology_info(cluster, environ, topology, role=None): ''' :param cluster: :param environ: :param topology: :param role: :return: ''' params = dict( cluster=cluster, environ=environ, topology=topology) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(INFO_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_comp_metrics_timeline(cluster, environ, topology, component, instances, metricnames, time_range, role=None): ''' Get the minute-by-minute metrics for all instances of a topology from tracker :param cluster: :param environ: :param topology: :param component: :param instances: :param metricnames: dict of display name to cuckoo name :param time_range: 2-tuple consisting of start and end of range :param role: :return: ''' params = dict( cluster=cluster, environ=environ, topology=topology, component=component) if role is not None: params['role'] = role # form the url request_url = tornado.httputil.url_concat(create_url(METRICS_TIMELINE_URL_FMT), params) if role is not None: request_url = tornado.httputil.url_concat(request_url, dict(role=role)) # append each metric to the url for metric_name in metricnames: request_url = tornado.httputil.url_concat(request_url, dict(metricname=metric_name)) # append each instance to the url for instance in instances: request_url = tornado.httputil.url_concat(request_url, dict(instance=instance)) # append the time interval to the url request_url = tornado.httputil.url_concat( request_url, dict(starttime=time_range[0], endtime=time_range[1])) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_filestats(cluster, environ, topology, container, path, role=None): ''' :param cluster: :param environ: :param topology: :param container: :param path: :param role: :return: ''' params = dict(cluster=cluster, environ=environ, topology=topology, container=container, path=path) if role is not None: params['role'] = role request_url = tornado.httputil.url_concat(create_url(FILESTATS_URL_FMT), params) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_clusters(): ''' :return: ''' request_url = create_url(CLUSTER_URL_FMT) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_topology_info(cluster, environ, topology): request_url = tornado.httputil.url_concat( create_url(INFO_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_scheduler_location(cluster, environ, topology): request_url = tornado.httputil.url_concat( create_url(SCHEDULER_LOCATION_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
def get_physical_plan(cluster, environ, topology): request_url = tornado.httputil.url_concat( create_url(PHYSICALPLAN_URL_FMT), dict(cluster=cluster, environ=environ, topology=topology)) raise tornado.gen.Return((yield fetch_url_as_json(request_url)))