diff --git a/beat/core/scripts/worker.py b/beat/core/scripts/worker.py index 5321dcdea1edc1e7128fab2bb63145c4d2e3307d..24754d33d5d9e41f5f2b0d124ebf25c3d9fca265 100755 --- a/beat/core/scripts/worker.py +++ b/beat/core/scripts/worker.py @@ -242,8 +242,12 @@ def main(user_input=None): content = simplejson.dumps(result['result']) logger.debug('send: """%s"""' % content.rstrip()) + status = WorkerController.DONE + if result['result']['status'] != 0: + status = WorkerController.JOB_ERROR + message = [ - WorkerController.DONE, + status, current_job_id, content ] @@ -262,6 +266,7 @@ def main(user_input=None): message = [ WorkerController.ERROR, + current_job_id, result['system_error'] ] diff --git a/beat/core/worker.py b/beat/core/worker.py index cd9fdcb8145535b731f3880eba9f1f549cd5dc37..e244bd2051696a15b78d3163df5642c6295ec277 100755 --- a/beat/core/worker.py +++ b/beat/core/worker.py @@ -139,6 +139,10 @@ class WorkerController(object): job_id = int(data[0]) return (address, status, job_id, data[1:]) + elif (status == WorkerController.ERROR) and (len(data) >= 2): + job_id = int(data[0]) + return (address, status, job_id, data[1:]) + else: job_id = None return (address, status, job_id, data)