提交 d5b1d266 authored 作者: Ziye Fan's avatar Ziye Fan

Revert "remove printing in replace_all_validate"

This reverts commit c3351883ccf7e4deea9508841c02e08b24bd4b8a.
上级 39b6e182
...@@ -208,14 +208,20 @@ class Validator(Feature): ...@@ -208,14 +208,20 @@ class Validator(Feature):
uf = cf.f_back uf = cf.f_back
uf_info = inspect.getframeinfo(uf) uf_info = inspect.getframeinfo(uf)
# Print if verbose, then raise # If the caller is replace_all_validate, just raise the
verbose = uf.f_locals.get('verbose', False) # exception. replace_all_validate will print out the
if verbose: # verbose output.
r = uf.f_locals.get('r', "") # Or it has to be done here before raise.
reason = uf_info.function if uf_info.function == 'replace_all_validate':
print("validate failed on node %s.\n Reason: %s, %s" % raise
(r, reason, e)) else:
raise verbose = uf.f_locals.get('verbose', False)
if verbose:
r = uf.f_locals.get('r', "")
reason = uf_info.function
print("validate failed on node %s.\n Reason: %s, %s" %
(r, reason, e))
raise
t1 = time.time() t1 = time.time()
if fgraph.profile: if fgraph.profile:
fgraph.profile.validate_time += t1 - t0 fgraph.profile.validate_time += t1 - t0
...@@ -287,6 +293,8 @@ class ReplaceValidate(History, Validator): ...@@ -287,6 +293,8 @@ class ReplaceValidate(History, Validator):
fgraph.validate() fgraph.validate()
except Exception as e: except Exception as e:
fgraph.revert(chk) fgraph.revert(chk)
if verbose:
print("validate failed on node %s.\n Reason: %s, %s" % (r, reason, e))
raise raise
if verbose: if verbose:
print(reason, r, new_r) print(reason, r, new_r)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论