From 84487fdecaaeff06d539c85ee26305436e2b7198 Mon Sep 17 00:00:00 2001 From: Norman Rzepka Date: Wed, 19 Oct 2022 09:19:25 +0200 Subject: [PATCH] adds ETA calculation to voxelytics tasks (#6564) * adds ETA calculation to voxelytics tasks * changelog Co-authored-by: Tom Herold --- CHANGELOG.unreleased.md | 1 + .../admin/voxelytics/task_list_view.tsx | 60 +++++++++++++++---- 2 files changed, 50 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index b41aaabfb13..d191b4e3bc9 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -20,6 +20,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released - When reloading a layer, because the underlying data has changed, the histogram will also be reloaded and reflect the changes. [#6537](https://github.com/scalableminds/webknossos/pull/6537) - Enable "What's New" update information for all instances. [#6563](https://github.com/scalableminds/webknossos/pull/6563) - Add context-menu option to delete skeleton root group. [#6553](https://github.com/scalableminds/webknossos/pull/6553) +- Added remaining task time estimation (ETA) for Voxelytics tasks in workflow reporting. [#6564](https://github.com/scalableminds/webknossos/pull/6564) ### Changed - Creating tasks in bulk now also supports referencing task types by their summary instead of id. [#6486](https://github.com/scalableminds/webknossos/pull/6486) diff --git a/frontend/javascripts/admin/voxelytics/task_list_view.tsx b/frontend/javascripts/admin/voxelytics/task_list_view.tsx index 07d6312ca9a..427524d2878 100644 --- a/frontend/javascripts/admin/voxelytics/task_list_view.tsx +++ b/frontend/javascripts/admin/voxelytics/task_list_view.tsx @@ -108,15 +108,53 @@ function TaskStateTag({ taskInfo }: { taskInfo: VoxelyticsTaskInfo }) { skipped ); - case VoxelyticsRunState.RUNNING: - return ( - Begin Time: {formatDateMedium(taskInfo.beginTime)}}> - } color="processing"> - running - - started {moment(taskInfo.beginTime).fromNow()} - - ); + case VoxelyticsRunState.RUNNING: { + const currentDuration = Date.now() - taskInfo.beginTime.getTime(); + if (taskInfo.chunksFinished > 0) { + const estimatedRemainingDuration = + (currentDuration / taskInfo.chunksFinished) * taskInfo.chunksTotal - currentDuration; + const estimatedEndTime = new Date(Date.now() + estimatedRemainingDuration); + return ( + + Begin Time: {formatDateMedium(taskInfo.beginTime)} +
+ Current Duration: {formatDurationStrict(moment.duration(currentDuration))} +
+ Estimated Remaining Duration:{" "} + {formatDurationStrict(moment.duration(estimatedRemainingDuration))} +
+ Estimated End Time: {formatDateMedium(estimatedEndTime)} + + } + > + } color="processing"> + running + + started {moment(taskInfo.beginTime).fromNow()}, probably finishes{" "} + {moment(estimatedEndTime).fromNow()} +
+ ); + } else { + return ( + + Begin Time: {formatDateMedium(taskInfo.beginTime)} +
+ Current Duration: {formatDurationStrict(moment.duration(currentDuration))} + + } + > + } color="processing"> + running + + started {moment(taskInfo.beginTime).fromNow()} +
+ ); + } + } case VoxelyticsRunState.STALE: return ( } color="error"> failed {" "} - {moment(taskInfo.endTime).fromNow()} after{" "} + {moment(taskInfo.endTime).fromNow()}, after{" "} {formatDistance(taskInfo.endTime, taskInfo.beginTime)} ); @@ -185,7 +223,7 @@ function TaskStateTag({ taskInfo }: { taskInfo: VoxelyticsTaskInfo }) { } color="success"> completed {" "} - {moment(taskInfo.endTime).fromNow()}{" "} + {moment(taskInfo.endTime).fromNow()},{" "} {formatDistance(taskInfo.endTime, taskInfo.beginTime)} );