本文整理汇总了Python中heron.common.src.python.color.Log.debug方法的典型用法代码示例。如果您正苦于以下问题:Python Log.debug方法的具体用法?Python Log.debug怎么用?Python Log.debug使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类heron.common.src.python.color.Log
的用法示例。
在下文中一共展示了Log.debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register_watch
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def register_watch(self, callback):
"""
Returns the UUID with which the watch is
registered. This UUID can be used to unregister
the watch.
Returns None if watch could not be registered.
The argument 'callback' must be a function that takes
exactly one argument, the topology on which
the watch was triggered.
Note that the watch will be unregistered in case
it raises any Exception the first time.
This callback is also called at the time
of registration.
"""
RETRY_COUNT = 5
# Retry in case UID is previously
# generated, just in case...
for _ in range(RETRY_COUNT):
# Generate a random UUID.
uid = uuid.uuid4()
if uid not in self.watches:
Log.info("Registering a watch with uid: " + str(uid))
try:
callback(self)
except Exception as e:
Log.error("Caught exception while triggering callback: " + str(e))
Log.debug(traceback.format_exc())
return None
self.watches[uid] = callback
return uid
return None
示例2: get
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get(self):
""" get method """
try:
cluster = self.get_argument_cluster()
role = self.get_argument_role()
environ = self.get_argument_environ()
topology_name = self.get_argument_topology()
container = self.get_argument(constants.PARAM_CONTAINER)
path = self.get_argument(constants.PARAM_PATH)
offset = self.get_argument_offset()
length = self.get_argument_length()
topology_info = self.tracker.getTopologyInfo(topology_name, cluster, role, environ)
stmgr_id = "stmgr-" + container
stmgr = topology_info["physical_plan"]["stmgrs"][stmgr_id]
host = stmgr["host"]
shell_port = stmgr["shell_port"]
file_data_url = "http://%s:%d/filedata/%s?offset=%s&length=%s" % \
(host, shell_port, path, offset, length)
http_client = tornado.httpclient.AsyncHTTPClient()
response = yield http_client.fetch(file_data_url)
self.write_success_response(json.loads(response.body))
self.finish()
except Exception as e:
Log.debug(traceback.format_exc())
self.write_error_response(e)
示例3: get_logical_plan
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get_logical_plan(cluster, env, topology, role):
"""Synced API call to get logical plans"""
instance = tornado.ioloop.IOLoop.instance()
try:
return instance.run_sync(lambda: API.get_logical_plan(cluster, env, topology, role))
except Exception:
Log.debug(traceback.format_exc())
raise
示例4: get_topology_metrics
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get_topology_metrics(*args):
"""Synced API call to get topology metrics"""
instance = tornado.ioloop.IOLoop.instance()
try:
return instance.run_sync(lambda: API.get_comp_metrics(*args))
except Exception:
Log.debug(traceback.format_exc())
raise
示例5: get_cluster_topologies
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get_cluster_topologies(cluster):
"""Synced API call to get topologies under a cluster"""
instance = tornado.ioloop.IOLoop.instance()
try:
return instance.run_sync(lambda: API.get_cluster_topologies(cluster))
except Exception:
Log.debug(traceback.format_exc())
raise
示例6: get_cluster_role_env_topologies
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get_cluster_role_env_topologies(cluster, role, env):
"""Synced API call to get topologies under a cluster submitted by a role under env"""
instance = tornado.ioloop.IOLoop.instance()
try:
return instance.run_sync(lambda: API.get_cluster_role_env_topologies(cluster, role, env))
except Exception:
Log.debug(traceback.format_exc())
raise
示例7: get_clusters
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get_clusters():
"""Synced API call to get all cluster names"""
instance = tornado.ioloop.IOLoop.instance()
# pylint: disable=unnecessary-lambda
try:
return instance.run_sync(lambda: API.get_clusters())
except Exception:
Log.debug(traceback.format_exc())
raise
示例8: get_component_metrics
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get_component_metrics(component, cluster, env, topology, role):
"""Synced API call to get component metrics"""
all_queries = metric_queries()
try:
result = get_topology_metrics(
cluster, env, topology, component, [], all_queries, [0, -1], role)
return result["metrics"]
except Exception:
Log.debug(traceback.format_exc())
raise
示例9: get
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get(self):
""" get method """
try:
cluster = self.get_argument_cluster()
role = self.get_argument_role()
environ = self.get_argument_environ()
topology_name = self.get_argument_topology()
topology_info = self.tracker.getTopologyInfo(topology_name, cluster, role, environ)
self.write_success_response(topology_info)
except Exception as e:
Log.debug(traceback.format_exc())
self.write_error_response(e)
示例10: get
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get(self):
""" get method """
try:
cluster = self.get_argument_cluster()
role = self.get_argument_role()
environ = self.get_argument_environ()
topology_name = self.get_argument_topology()
instance = self.get_argument_instance()
topology_info = self.tracker.getTopologyInfo(topology_name, cluster, role, environ)
ret = yield self.getInstanceMemoryHistogram(topology_info, instance)
self.write_success_response(ret)
except Exception as e:
Log.debug(traceback.format_exc())
self.write_error_response(e)
示例11: getInstancePid
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
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))
示例12: on_topologies_watch
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def on_topologies_watch(state_manager, topologies):
"""watch topologies"""
Log.info("State watch triggered for topologies.")
Log.debug("Topologies: " + str(topologies))
existingTopologies = self.getTopologiesForStateLocation(state_manager.name)
existingTopNames = map(lambda t: t.name, existingTopologies)
Log.debug("Existing topologies: " + str(existingTopNames))
for name in existingTopNames:
if name not in topologies:
Log.info("Removing topology: %s in rootpath: %s",
name, state_manager.rootpath)
self.removeTopology(name, state_manager.name)
for name in topologies:
if name not in existingTopNames:
self.addNewTopology(state_manager, name)
示例13: trigger_watches
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def trigger_watches(self):
"""
Call all the callbacks.
If any callback raises an Exception,
unregister the corresponding watch.
"""
to_remove = []
for uid, callback in self.watches.iteritems():
try:
callback(self)
except Exception as e:
Log.error("Caught exception while triggering callback: " + str(e))
Log.debug(traceback.format_exc())
to_remove.append(uid)
for uid in to_remove:
self.unregister_watch(uid)
示例14: getInstanceMemoryHistogram
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
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))
示例15: get
# 需要导入模块: from heron.common.src.python.color import Log [as 别名]
# 或者: from heron.common.src.python.color.Log import debug [as 别名]
def get(self):
""" get method """
try:
cluster = self.get_argument_cluster()
role = self.get_argument_role()
environ = self.get_argument_environ()
topology_name = self.get_argument_topology()
topology = self.tracker.getTopologyByClusterRoleEnvironAndName(
cluster, role, environ, topology_name)
start_time = self.get_argument_starttime()
end_time = self.get_argument_endtime()
self.validateInterval(start_time, end_time)
query = self.get_argument_query()
metrics = yield tornado.gen.Task(self.executeMetricsQuery,
topology.tmaster, query, int(start_time), int(end_time))
self.write_success_response(metrics)
except Exception as e:
Log.debug(traceback.format_exc())
self.write_error_response(e)