Commit 0e0d722d authored by Paul Rich's avatar Paul Rich
Browse files

updaing TS and TE with location and start/end times as UT

parent 2df5a45d
......@@ -705,6 +705,7 @@ class Job (StateMachine):
if self.user_hold:
dbwriter.log_to_db(self.user, "user_hold", "job_prog", JobProgMsg(self))
self.current_task_start = time.time()
self.initializing = False
......@@ -786,6 +787,7 @@ class Job (StateMachine):
if self.ion_kerneloptions == False:
self.ion_kerneloptions = None
self.runid = state.get("runid", None)
self.current_task_start = state.get("current_task_start", None)
#for old statefiles, make sure to update the dependency state on restart:
self.__dep_hold = False
self.initializing = False
......@@ -885,7 +887,8 @@ class Job (StateMachine):
else:
self.__max_job_timer = Timer()
self.__max_job_timer.start()
task_start = accounting.task_start(self.jobid, self.runid)
self.current_task_start = time.time()
task_start = accounting.task_start(self.jobid, self.runid, self.current_task_start, self.location)
accounting_logger.info(task_start)
logger.info(task_start)
return Job.__rc_success
......@@ -894,7 +897,9 @@ class Job (StateMachine):
'''get exit code from system component'''
def end_time_and_log():
self.__max_job_timer.stop()
task_end = accounting.task_end(self.jobid, self.runid, self.__max_job_timer.elapsed_times[-1])
task_end = accounting.task_end(self.jobid, self.runid, self.__max_job_timer.elapsed_times[-1], self.current_task_start,
time.time(), self.location)
self.current_task_start = None
accounting_logger.info(task_end)
logger.info(task_end)
try:
......
......@@ -255,26 +255,31 @@ def confirmed (reservation_id, requester):
return entry("Y", reservation_id, {'requester':requester})
def task_start(job_id, task_id):
def task_start(job_id, task_id, start_time, location):
'''Indicate a task has started. Typically this would indicate that add_process_groups has been called successfully.
Args:
job_id - id of job that this task belongs to
task_id - id of the task launched
start_time - time when the task started as seconds from epoch
locaiton - a list of locations that this task is running on
'''
return entry("TS", job_id, {'task_id': task_id})
return entry("TS", job_id, {'task_id': task_id, 'start': start_time, 'location': location})
def task_end(job_id, task_id, task_runtime):
def task_end(job_id, task_id, task_runtime, start_time, end_time, location):
'''Indicate a task has started. Typically this would indicate that add_process_groups has been called successfully.
Args:
job_id - id of job that this task belongs to
task_id - id of the task launched
task_runtime - The running time of the task in seconds. Start time for this is the task_start record timestamp.
start_time - time when the task started as seconds from epoch
end_time - tme when the task ended as seconds from epoch
locaiton - a list of locations that this task is running on
'''
return entry("TE", job_id, {'task_id': task_id, 'task_runtime': task_runtime})
return entry("TE", job_id, {'task_id': task_id, 'task_runtime': task_runtime, 'start': start_time, 'end': end_time, 'location': location})
class DatetimeFileHandler (BaseRotatingHandler):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment