update db when some task failed
This commit is contained in:
parent
de21833f4c
commit
f346901fc6
|
@ -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":
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue