diff --git a/src/master/jobmgr.py b/src/master/jobmgr.py index 9f7a514..2c661fe 100644 --- a/src/master/jobmgr.py +++ b/src/master/jobmgr.py @@ -400,7 +400,18 @@ class JobMgr(): job_id, task_idx = split_task_name if job_id not in self.job_map.keys(): logger.error("[jobmgr report]jobid(%s) does not exist. task_name(%s)" % (job_id,task_name)) - #TODO: update data in db + #update data in db + taskdb = Batchtask.query.get(task_name) + if (taskdb is None or taskdb.status == 'finished' or + taskdb.status == 'failed' or taskdb.status == 'stopped'): + return + taskdb.status = status + if status == 'failed': + taskdb.failed_reason = reason + if billing > 0: + taskdb.running_time = running_time + taskdb.billing = billing + db_commit() return job = self.job_map[job_id] if status == "running": diff --git a/src/worker/taskworker.py b/src/worker/taskworker.py index b6f7c2e..83304ed 100755 --- a/src/worker/taskworker.py +++ b/src/worker/taskworker.py @@ -432,7 +432,7 @@ class TaskWorker(rpc_pb2_grpc.WorkerServicer): self.add_msg(taskid,username,vnodeid,rpc_pb2.COMPLETED,token,"") else: logger.info("Task(%s-%s-%s) failed." % (str(taskid),str(vnodeid),token)) - self.add_msg(taskid,username,vnodeid,rpc_pb2.FAILED,token,"") + self.add_msg(taskid,username,vnodeid,rpc_pb2.FAILED,token,"Runtime Error. More information in stderr log.") def add_msg(self,taskid,username,vnodeid,status,token,errmsg): self.msgslock.acquire()