def try_server_call(partial_function):
"""
Simple server call wrapper function.
- Take a functools.partial object with the function to call and arguments populated.
- Calls the method, and logs how long the server takes to respond.
"""
with Timer() as t:
try:
results = partial_function()
except Exception, err:
logger.critical(
"User '%s' (id: %s) failed to get response from server.",
name, name_to_id(name))
logger.critical("Function call: %s(%s)",
str(partial_function.func).split()[2], None)
logger.critical("Error: %s", repr(err))
raise # Debug
# return None
logger.debug("%.03f - %s (results: %s)",
t.elapsed, str(partial_function.func).split()[2], results)
return results
mimus_client.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录