13
13
14
14
import __main__
15
15
16
+ import datetime
16
17
import json
17
18
import logging
18
19
import os
@@ -96,6 +97,7 @@ async def exec_job(args):
96
97
"wrapper_arguments" : args_dict ,
97
98
"complete" : False ,
98
99
}
100
+ start_time = datetime .datetime .now (datetime .timezone .utc )
99
101
lib .util .timestamp ("start_time" , out_data )
100
102
with litani .atomic_write (args .status_file ) as handle :
101
103
print (json .dumps (out_data , indent = 2 ), file = handle )
@@ -105,6 +107,7 @@ async def exec_job(args):
105
107
args .timeout , args .profile_memory , args .profile_memory_interval ,
106
108
args_dict ["job_id" ])
107
109
await run ()
110
+ end_time = datetime .datetime .now (datetime .timezone .utc )
108
111
lib .job_outcome .fill_in_result (run , out_data , args )
109
112
110
113
for out_field , proc_pipe , arg_file in [
@@ -127,6 +130,11 @@ async def exec_job(args):
127
130
file = sys .stderr )
128
131
129
132
lib .util .timestamp ("end_time" , out_data )
133
+
134
+ duration = end_time - start_time
135
+ dur_sec = duration .seconds + (duration .days * 60 * 60 * 24 )
136
+ out_data ["duration_ms" ] = f"{ dur_sec } .{ duration .microseconds } "
137
+
130
138
out_str = json .dumps (out_data , indent = 2 )
131
139
logging .debug ("run status: %s" , out_str )
132
140
with litani .atomic_write (args .status_file ) as handle :
0 commit comments