本文整理汇总了Python中utils.logger.exception函数的典型用法代码示例。如果您正苦于以下问题:Python exception函数的具体用法?Python exception怎么用?Python exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exception函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_from_file
def create_from_file(cls, proj, src_file):
filename, extention = os.path.splitext(src_file)
if extention not in cls.SRC_EXTENSIONS:
return []
tag_docs = []
with open(src_file, 'r') as f:
s = f.read()
for comment in COMMENT_PATTERN.finditer(s):
match = PHONELAB_DOC_PATTERN.search(comment.group('body'))
if match is None:
continue
try:
text = ' '.join([l.strip() for l in match.group(
'json').replace('*', '').splitlines()])
doc = json.loads(text)
tag_docs.append(TagDoc(doc, proj, src_file,
s.count('\n', 0, comment.start()) + 1))
except:
logger.exception("Invalid doc string in file %s: %s" %
(src_file, match.group('json')))
logger.info("JSON Text: %s" % (text))
continue
return tag_docs
示例2: fetch_project_flows
def fetch_project_flows(self, project):
"""
获取project的flowid
返回 flowid list
"""
method = "GET"
url = config["manager"]
params = {
"ajax": "fetchprojectflows",
"project": project
}
content, ok = self.get_ajax(method, url, params)
flowids = []
if ok:
try:
res = json.loads(content)
flowids = map(lambda e: e["flowId"], res["flows"])
except Exception as e:
logger.exception(e)
return []
logger.info(
"fetch_project_flows {0} : {1} SUCCESS".format(
project, flowids))
return flowids
else:
logger.info("fetch_project_flows {0} FAILED".format(project))
return flowids
示例3: login
def login():
"""
利用config中的userame和password登陆
返回是否成功
"""
logger.info("login")
if Azkaban.sid:
return True
ok = False
for i in range(config["retry"]):
try:
params = {
'action': "login",
'username': config["username"],
'password': config["password"]
}
r = requests.post(config["manager"], params)
content = r.text
debug_print(content)
Azkaban.sid = str(json.loads(content)["session.id"])
ok = True
break
except Exception as e:
logger.exception("login exception: {e}".format(e=e))
logger.info("login update sid {0}".format(Azkaban.sid))
return ok
示例4: main
def main():
rel_info = ReleaseInfo()
start_directory = os.getcwd()
parse_args(rel_info)
try:
setup_test_branch(rel_info)
merge_branches(rel_info)
test_tag_doc(rel_info)
if rel_info.args.merge_only:
return
build_platform(rel_info)
except KeyboardInterrupt:
pass
except:
logger.exception("[FAILED] Please check your changes. "\
"You can not pass this checker unless your branch "\
"can be merged without conflicts.")
logger.info("Note: all repos are in test branch %s" % rel_info.test_branch)
else:
logger.info(
"[PASS] Your changes can be successfully merged and build.")
finally:
cleanup(rel_info)
os.chdir(start_directory)