diff --git a/jobmanagement.py b/jobmanagement.py index facc14993b7b6934b3d7e1f48c7321564a548f0a..00c3587bdd65f8b48b7d495550978971180562bb 100644 --- a/jobmanagement.py +++ b/jobmanagement.py @@ -1,4 +1,4 @@ -from server import modify, query, date_json_handler, sched_func +from server import modify, query, date_json_handler, sched_func, notify_admins from datetime import datetime, timedelta import traceback import json @@ -22,6 +22,7 @@ def job_handler_handle(id, state): try: func(id, job['type'], json.loads(job['data']), state, json.loads(job['status'])) except Exception: + notify_admins('scheduler_exception', name=func.__name__, traceback=traceback.format_exc()) traceback.print_exc() @sched_func(10) diff --git a/sorter.py b/sorter.py index 2e543ec75938b500b0b7307e2fee83f3ef81bfdd..0a551cce0646ffccf6ccdad97ef96b67d61c405d 100644 --- a/sorter.py +++ b/sorter.py @@ -35,8 +35,7 @@ def update_video_metadata(jobid, jobtype, data, state, status): if jobtype not in ['remux', 'transcode']: video = query('SELECT * FROM videos WHERE id = ?', data['video_id'])[0] if video['hash'] and video['hash'] != status['hash']: - print('Hash mismatch for video', data['video_id']) - return + raise Exception('Hash mismatch for video {}'.format(data['video_id'])) modify('UPDATE videos_data SET hash = ?, file_size = ?, duration = ? WHERE id = ?', status['hash'], status['filesize'], status['duration'], data['video_id'])