From b212879b09dfa41bbd0a49bc88926d2f90c567cd Mon Sep 17 00:00:00 2001 From: Johannes Findeisen Date: Fri, 22 Nov 2013 20:32:14 +0100 Subject: [PATCH] some more JobInformation stuff and mongodb task update --- linspector/core/job.py | 14 +++++++++++++- linspector/tasks/storage/mongodb.py | 4 +++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/linspector/core/job.py b/linspector/core/job.py index 1a0c9a5..ca25064 100644 --- a/linspector/core/job.py +++ b/linspector/core/job.py @@ -87,15 +87,18 @@ class Job: self.job_threshold -= 1 self.status = "OK" + self.job_information.set_status(self.status) self.job_information.inc_job_overall_wins() else: self.status = "WARNING" + self.job_information.set_status(self.status) self.job_information.inc_job_overall_fails() self.job_threshold += 1 if self.job_threshold >= service_threshold: logger.info("Job " + self.get_job_id() + ", Threshold reached!") self.status = "ERROR" + self.job_information.set_status(self.status) def handle_tasks(self, job_information): for member in self.members: @@ -211,8 +214,17 @@ class JobInformation(object): def inc_job_overall_wins(self): self.job_overall_wins += 1 + def get_job_id(self): + return self.job_id + def get_response_message(self): return self.response_massage def set_response_message(self, msg): - self.response_massage = msg \ No newline at end of file + self.response_massage = msg + + def get_status(self): + return self.status + + def set_status(self, status): + self.status = status \ No newline at end of file diff --git a/linspector/tasks/storage/mongodb.py b/linspector/tasks/storage/mongodb.py index f168b3c..7ef9b67 100644 --- a/linspector/tasks/storage/mongodb.py +++ b/linspector/tasks/storage/mongodb.py @@ -57,7 +57,9 @@ class MongodbTask(Task): def execute(self, job_information): data = {"timestamp": str(datetime.datetime.now()), - "msg": job_information.get_response_message()} + "msg": job_information.get_response_message(), + "status": job_information.get_status(), + "job_id": job_information.get_job_id()} self.mongo_db_collection.insert(data)