@@ -231,12 +231,11 @@ def format_scattered_task(task_name, task_metadata):
231
231
filtered_shards = []
232
232
current_shard = ''
233
233
min_start = _parse_datetime (task_metadata [0 ].get ('start' ))
234
+ max_end = _parse_datetime (task_metadata [- 1 ].get ('end' ))
234
235
235
236
# go through calls in reverse to grab the latest attempt if there are multiple
236
237
for shard in task_metadata [::- 1 ]:
237
238
if current_shard != shard .get ('shardIndex' ):
238
- if min_start > _parse_datetime (shard .get ('start' )):
239
- min_start = _parse_datetime (shard .get ('start' ))
240
239
filtered_shards .append (
241
240
TaskShard (
242
241
execution_status = task_statuses .cromwell_execution_to_api (
@@ -246,6 +245,13 @@ def format_scattered_task(task_name, task_metadata):
246
245
shard_index = shard .get ('shardIndex' ),
247
246
execution_events = _get_execution_events (
248
247
shard .get ('executionEvents' ))))
248
+ if min_start > _parse_datetime (shard .get ('start' )):
249
+ min_start = _parse_datetime (shard .get ('start' ))
250
+ if shard .get ('executionStatus' ) not in ['Failed' , 'Done' ]:
251
+ max_end = None
252
+ if max_end is not None and max_end < _parse_datetime (
253
+ shard .get ('end' )):
254
+ max_end = _parse_datetime (shard .get ('end' ))
249
255
current_shard = shard .get ('shardIndex' )
250
256
251
257
sorted_shards = sorted (filtered_shards , key = lambda t : t .shard_index )
@@ -255,6 +261,7 @@ def format_scattered_task(task_name, task_metadata):
255
261
execution_status = _get_scattered_task_status (sorted_shards ),
256
262
attempts = len (sorted_shards ),
257
263
start = min_start ,
264
+ end = max_end ,
258
265
call_root = remove_shard_path (task_metadata [- 1 ].get ('callRoot' )),
259
266
shards = sorted_shards ,
260
267
call_cached = False )
0 commit comments