Skip to content

Commit

Permalink
Fix duration bug for scattered tasks (#618)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsasch authored Apr 10, 2019
1 parent f1a2b67 commit 23438eb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Job Manager Change Log

## v0.7.1 Release Notes

### Added individual shards and their execution events to the timing diagram.

## v0.7.0 Release Notes

### Further improved the performance of the Job dDetails page when pointed at Cromwell.

### Made the behavior of all log and execution directory icons/links consistent throughout the Job Details page.

### Added more useful UI behavior when user submits an invalid query on the Job List page.

### Surfaced additional error information from Cromwell metadata responses on the Job Details page.

## v0.6.3 Release Notes

### Fixed bug where failure message(s) are not displayed if the job failed before Cromwell was able to run it (most likely due to a validation error).
Expand Down
11 changes: 9 additions & 2 deletions servers/cromwell/jobs/controllers/jobs_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,11 @@ def format_scattered_task(task_name, task_metadata):
filtered_shards = []
current_shard = ''
min_start = _parse_datetime(task_metadata[0].get('start'))
max_end = _parse_datetime(task_metadata[-1].get('end'))

# go through calls in reverse to grab the latest attempt if there are multiple
for shard in task_metadata[::-1]:
if current_shard != shard.get('shardIndex'):
if min_start > _parse_datetime(shard.get('start')):
min_start = _parse_datetime(shard.get('start'))
filtered_shards.append(
TaskShard(
execution_status=task_statuses.cromwell_execution_to_api(
Expand All @@ -246,6 +245,13 @@ def format_scattered_task(task_name, task_metadata):
shard_index=shard.get('shardIndex'),
execution_events=_get_execution_events(
shard.get('executionEvents'))))
if min_start > _parse_datetime(shard.get('start')):
min_start = _parse_datetime(shard.get('start'))
if shard.get('executionStatus') not in ['Failed', 'Done']:
max_end = None
if max_end is not None and max_end < _parse_datetime(
shard.get('end')):
max_end = _parse_datetime(shard.get('end'))
current_shard = shard.get('shardIndex')

sorted_shards = sorted(filtered_shards, key=lambda t: t.shard_index)
Expand All @@ -255,6 +261,7 @@ def format_scattered_task(task_name, task_metadata):
execution_status=_get_scattered_task_status(sorted_shards),
attempts=len(sorted_shards),
start=min_start,
end=max_end,
call_root=remove_shard_path(task_metadata[-1].get('callRoot')),
shards=sorted_shards,
call_cached=False)
Expand Down
1 change: 1 addition & 0 deletions servers/cromwell/jobs/test/test_jobs_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ def _request_callback(request, context):
'callCached': False,
'attempts': attempts,
'start': response_timestamp,
'end': response_timestamp,
'shards': [{
'end': response_timestamp,
'executionStatus': 'Failed',
Expand Down

0 comments on commit 23438eb

Please sign in to comment.