Log the exception if the worker fails.
This commit is contained in:
parent
e39d99b2ac
commit
edee5e6b58
3 changed files with 19 additions and 15 deletions
10
tools.py
10
tools.py
|
|
@ -563,6 +563,16 @@ php5_syntax.dependencies = {"php"}
|
||||||
#############################
|
#############################
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LOG_PATH = os.path.join(os.getcwd(), "vigil.log")
|
||||||
|
|
||||||
|
|
||||||
|
def log_error(message=None):
|
||||||
|
message = traceback.format_exc() if message is None else message + "\n"
|
||||||
|
with open(LOG_PATH, "a") as log_file:
|
||||||
|
log_file.write(message)
|
||||||
|
|
||||||
|
|
||||||
def lru_cache_with_eviction(maxsize=128, typed=False):
|
def lru_cache_with_eviction(maxsize=128, typed=False):
|
||||||
versions = {}
|
versions = {}
|
||||||
make_key = functools._make_key
|
make_key = functools._make_key
|
||||||
|
|
|
||||||
9
vigil
9
vigil
|
|
@ -84,15 +84,6 @@ KEYS_DOC = """Keys:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
LOG_PATH = os.path.join(os.getcwd(), "vigil.log")
|
|
||||||
|
|
||||||
|
|
||||||
def log_error(message=None):
|
|
||||||
message = traceback.format_exc() if message is None else message + "\n"
|
|
||||||
with open(LOG_PATH, "a") as log_file:
|
|
||||||
log_file.write(message)
|
|
||||||
|
|
||||||
|
|
||||||
class Entry(collections.UserList):
|
class Entry(collections.UserList):
|
||||||
|
|
||||||
def __init__(self, path, results, summary, highlighted=None,
|
def __init__(self, path, results, summary, highlighted=None,
|
||||||
|
|
|
||||||
15
worker.py
15
worker.py
|
|
@ -81,12 +81,15 @@ class Worker:
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
print(os.getpid(), flush=True)
|
print(os.getpid(), flush=True)
|
||||||
while True:
|
try:
|
||||||
tool_name, path = input(), input()
|
while True:
|
||||||
tool = getattr(tools, tool_name)
|
tool_name, path = input(), input()
|
||||||
result = tools.Result(path, tool)
|
tool = getattr(tools, tool_name)
|
||||||
status, result.result = tools.run_tool_no_error(path, tool)
|
result = tools.Result(path, tool)
|
||||||
print(status.value, flush=True)
|
status, result.result = tools.run_tool_no_error(path, tool)
|
||||||
|
print(status.value, flush=True)
|
||||||
|
except:
|
||||||
|
tools.log_error()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue