automation: add full stack trace for exceptions to logs
This commit is contained in:
parent
4be3e830c9
commit
83862ab47f
2 changed files with 10 additions and 7 deletions
|
@ -2,6 +2,7 @@ import argparse
|
|||
import datetime
|
||||
import json
|
||||
import logging
|
||||
from traceback import TracebackException
|
||||
|
||||
from app import app
|
||||
from app.extensions import db
|
||||
|
@ -84,8 +85,9 @@ def run_job(job: BaseAutomation, *, force: bool = False, ignore_schedule: bool =
|
|||
try:
|
||||
success, logs = job.automate()
|
||||
except Exception as e:
|
||||
tb = TracebackException.from_exception(e)
|
||||
success = False
|
||||
logs = repr(e)
|
||||
logs = "".join(tb.format())
|
||||
if success:
|
||||
automation.state = AutomationState.IDLE
|
||||
automation.next_run = datetime.datetime.utcnow() + datetime.timedelta(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue