Fixes #5 #6
@ -2,6 +2,7 @@
|
|||||||
queue = /some/dir
|
queue = /some/dir
|
||||||
storage = /another/dir
|
storage = /another/dir
|
||||||
processing = /a/third/dir
|
processing = /a/third/dir
|
||||||
|
error = /an/error_dir
|
||||||
notify_url = https://example.com/api/notify
|
notify_url = https://example.com/api/notify
|
||||||
notify_token = <jwt token>
|
notify_token = <jwt token>
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ from pipeline import Pipeline
|
|||||||
class Daemon:
|
class Daemon:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.queue_dir = config['daemon']['queue']
|
self.queue_dir = config['daemon']['queue']
|
||||||
|
self.error_dir = config['daemon']['error']
|
||||||
self.logger = logging.getLogger('play-daemon')
|
self.logger = logging.getLogger('play-daemon')
|
||||||
self.logger.setLevel('DEBUG')
|
self.logger.setLevel('DEBUG')
|
||||||
if 'mail_level' in config['daemon']:
|
if 'mail_level' in config['daemon']:
|
||||||
@ -51,6 +52,9 @@ class Daemon:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = "Exception during processing of queue item %s: %s"
|
msg = "Exception during processing of queue item %s: %s"
|
||||||
self.logger.exception(msg, pres_id, queue_item, exc_info=e)
|
self.logger.exception(msg, pres_id, queue_item, exc_info=e)
|
||||||
|
with open(os.path.join(self.error_dir, pres_id), 'w') as f:
|
||||||
|
queue_item['error'] = e
|
||||||
|
json.dump(queue_item, f)
|
||||||
|
|
||||||
|
|
||||||
class QueueUpdater(FileSystemEventHandler):
|
class QueueUpdater(FileSystemEventHandler):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user