Skip to content
Snippets Groups Projects
Commit 7c1f18d7 authored by Martin Mareš's avatar Martin Mareš
Browse files

Jobs: Rozlišujeme stavy failed a internal_error

Joby ve stavu internal_error automaticky neexpirují a půjdou rozpoznat
případnými monitorovacími skripty.
parent ec32c3da
No related branches found
No related tags found
1 merge request!109Automatická oprava rozbitých PDF
This commit is part of merge request !109. Comments created here will be created in the context of that merge request.
......@@ -147,6 +147,10 @@ class TheJob:
_handler_table[job.type](self)
if self.errors:
logger.info(f'Job: Neúspěšně dokončen job #{job.job_id} ({job.result})')
if job.user_id == 0:
# Joby běžící na systémového uživatele produkují interní chyby
job.state = db.JobState.internal_error
else:
job.state = db.JobState.failed
job.out_json = {'errors': self.errors}
if job.result == "":
......@@ -156,10 +160,11 @@ class TheJob:
job.state = db.JobState.done
except Exception as e:
logger.error(f'Job: Chyba při zpracování jobu #{job.job_id}: %s', e, exc_info=e)
job.state = db.JobState.failed
job.state = db.JobState.internal_error
job.result = 'Interní chyba, informujte prosím správce systému.'
job.finished_at = mo.util.get_now()
if job.state != db.JobState.internal_error:
job.expires_at = job.finished_at + timedelta(minutes=self.expires_in_minutes)
sess.commit()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment