예제 #1
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #2
0
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)
예제 #3
0
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)))
예제 #4
0
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)))
예제 #5
0
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)))
예제 #6
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #7
0
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)))
예제 #8
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #9
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #10
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #11
0
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)))
예제 #12
0
파일: heron.py 프로젝트: Hangjun/heron
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)))
예제 #13
0
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)))
예제 #14
0
파일: heron.py 프로젝트: Hangjun/heron
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)))
예제 #15
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #16
0
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)))
예제 #17
0
파일: heron.py 프로젝트: Hangjun/heron
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)))
예제 #18
0
파일: heron.py 프로젝트: Hangjun/heron
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)))
예제 #19
0
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)))
예제 #20
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #21
0
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)))
예제 #22
0
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)))
예제 #23
0
파일: heron.py 프로젝트: 10fish/heron
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)
예제 #24
0
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)))
예제 #25
0
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)))
예제 #26
0
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)))
예제 #27
0
파일: heron.py 프로젝트: Hangjun/heron
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)
예제 #28
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #29
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #30
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #31
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #32
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #33
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #34
0
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)))
예제 #35
0
파일: heron.py 프로젝트: Hangjun/heron
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)))
예제 #36
0
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)))
예제 #37
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #38
0
파일: heron.py 프로젝트: 10fish/heron
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)))
예제 #39
0
파일: heron.py 프로젝트: Hangjun/heron
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)))
예제 #40
0
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)))
예제 #41
0
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)))
예제 #42
0
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)))
예제 #43
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #44
0
파일: heron.py 프로젝트: Hangjun/heron
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)))
예제 #45
0
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)))
예제 #46
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #47
0
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)))
예제 #48
0
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)))
예제 #49
0
파일: heron_api.py 프로젝트: mahak/heron
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)
예제 #50
0
파일: heron_api.py 프로젝트: mahak/heron
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)
예제 #51
0
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)
예제 #52
0
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)
예제 #53
0
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)))
예제 #54
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #55
0
파일: heron_api.py 프로젝트: mahak/heron
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)))
예제 #56
0
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)))
예제 #57
0
def get_clusters():
    '''
  :return:
  '''
    request_url = create_url(CLUSTER_URL_FMT)
    raise tornado.gen.Return((yield fetch_url_as_json(request_url)))
예제 #58
0
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)))
예제 #59
0
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)))
예제 #60
0
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)))