some more JobInformation stuff and mongodb task update
This commit is contained in:
parent
5086520ed2
commit
b212879b09
2 changed files with 16 additions and 2 deletions
|
|
@ -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
|
||||
self.response_massage = msg
|
||||
|
||||
def get_status(self):
|
||||
return self.status
|
||||
|
||||
def set_status(self, status):
|
||||
self.status = status
|
||||
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue