Example #1
0
def getInstancePid(topology_info, instance_id):
  """
  This method is used by other modules, and so it
  is not a part of the class.
  Fetches Instance pid from heron-shell.
  """
  try:
    http_client = tornado.httpclient.AsyncHTTPClient()
    endpoint = utils.make_shell_endpoint(topology_info, instance_id)
    url = "%s/pid/%s" % (endpoint, instance_id)
    LOG.debug("HTTP call for url: %s", url)
    response = yield http_client.fetch(url)
    raise tornado.gen.Return(response.body)
  except tornado.httpclient.HTTPError as e:
    raise Exception(str(e))
Example #2
0
def getInstancePid(topology_info, instance_id):
    """
  This method is used by other modules, and so it
  is not a part of the class.
  Fetches Instance pid from heron-shell.
  """
    try:
        http_client = tornado.httpclient.AsyncHTTPClient()
        endpoint = utils.make_shell_endpoint(topology_info, instance_id)
        url = "%s/pid/%s" % (endpoint, instance_id)
        LOG.debug("HTTP call for url: %s" % url)
        response = yield http_client.fetch(url)
        raise tornado.gen.Return(response.body)
    except tornado.httpclient.HTTPError as e:
        raise Exception(str(e))
Example #3
0
 def runInstanceJmap(self, topology_info, instance_id):
     """
 Fetches Instance jstack from heron-shell.
 """
     pid_response = yield getInstancePid(topology_info, instance_id)
     try:
         http_client = tornado.httpclient.AsyncHTTPClient()
         pid_json = json.loads(pid_response)
         pid = pid_json['stdout'].strip()
         if pid == '':
             raise Exception('Failed to get pid')
         endpoint = utils.make_shell_endpoint(topology_info, instance_id)
         url = "%s/jmap/%s" % (endpoint, pid)
         response = yield http_client.fetch(url)
         LOG.debug("HTTP call for url: %s" % url)
         raise tornado.gen.Return(response.body)
     except tornado.httpclient.HTTPError as e:
         raise Exception(str(e))
Example #4
0
 def getInstanceJstack(self, topology_info, instance_id):
   """
   Fetches Instance jstack from heron-shell.
   """
   pid_response = yield getInstancePid(topology_info, instance_id)
   try:
     http_client = tornado.httpclient.AsyncHTTPClient()
     pid_json = json.loads(pid_response)
     pid = pid_json['stdout'].strip()
     if pid == '':
       raise Exception('Failed to get pid')
     endpoint = utils.make_shell_endpoint(topology_info, instance_id)
     url = "%s/jstack/%s" % (endpoint, pid)
     response = yield http_client.fetch(url)
     LOG.debug("HTTP call for url: %s" % url)
     raise tornado.gen.Return(response.body)
   except tornado.httpclient.HTTPError as e:
     raise Exception(str(e))
Example #5
0
 def getInstanceMemoryHistogram(self, topology_info, instance_id):
     """
 Fetches Instance top memory item as histogram.
 """
     pid_response = yield getInstancePid(topology_info, instance_id)
     try:
         http_client = tornado.httpclient.AsyncHTTPClient()
         pid_json = json.loads(pid_response)
         pid = pid_json['stdout'].strip()
         if pid == '':
             raise Exception('Failed to get pid')
         endpoint = utils.make_shell_endpoint(topology_info, instance_id)
         url = "%s/histo/%s" % (endpoint, pid)
         response = yield http_client.fetch(url)
         Log.debug("HTTP call for url: %s", url)
         raise tornado.gen.Return(response.body)
     except tornado.httpclient.HTTPError as e:
         raise Exception(str(e))
Example #6
0
 def getInstanceMemoryHistogram(self, topology_info, instance_id):
   """
   Fetches Instance top memory item as histogram.
   """
   pid_response = yield getInstancePid(topology_info, instance_id)
   try:
     http_client = tornado.httpclient.AsyncHTTPClient()
     component_id = instance_id.split('_')[1] # Format: container_<id>_<instance_id>
     pid_json = json.loads(pid_response)
     pid = pid_json['stdout'].strip()
     if pid == '':
       raise Exception('Failed to get pid')
     endpoint = utils.make_shell_endpoint(topology_info, instance_id)
     url = "%s/histo/%s" % (endpoint, pid)
     response = yield http_client.fetch(url)
     LOG.debug("HTTP call for url: %s" % url)
     raise tornado.gen.Return(response.body)
   except tornado.httpclient.HTTPError as e:
     raise Exception(str(e))