Skip to content

Commit

Permalink
adds ETA calculation to voxelytics tasks (#6564)
Browse files Browse the repository at this point in the history
* adds ETA calculation to voxelytics tasks

* changelog

Co-authored-by: Tom Herold <[email protected]>
  • Loading branch information
normanrz and hotzenklotz authored Oct 19, 2022
1 parent 8b2358a commit 84487fd
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
60 changes: 49 additions & 11 deletions frontend/javascripts/admin/voxelytics/task_list_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,53 @@ function TaskStateTag({ taskInfo }: { taskInfo: VoxelyticsTaskInfo }) {
skipped
</Tag>
);
case VoxelyticsRunState.RUNNING:
return (
<Tooltip title={<>Begin Time: {formatDateMedium(taskInfo.beginTime)}</>}>
<Tag icon={<SyncOutlined spin />} color="processing">
running
</Tag>
started {moment(taskInfo.beginTime).fromNow()}
</Tooltip>
);
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 (
<Tooltip
title={
<>
Begin Time: {formatDateMedium(taskInfo.beginTime)}
<br />
Current Duration: {formatDurationStrict(moment.duration(currentDuration))}
<br />
Estimated Remaining Duration:{" "}
{formatDurationStrict(moment.duration(estimatedRemainingDuration))}
<br />
Estimated End Time: {formatDateMedium(estimatedEndTime)}
</>
}
>
<Tag icon={<SyncOutlined spin />} color="processing">
running
</Tag>
started {moment(taskInfo.beginTime).fromNow()}, probably finishes{" "}
{moment(estimatedEndTime).fromNow()}
</Tooltip>
);
} else {
return (
<Tooltip
title={
<>
Begin Time: {formatDateMedium(taskInfo.beginTime)}
<br />
Current Duration: {formatDurationStrict(moment.duration(currentDuration))}
</>
}
>
<Tag icon={<SyncOutlined spin />} color="processing">
running
</Tag>
started {moment(taskInfo.beginTime).fromNow()}
</Tooltip>
);
}
}
case VoxelyticsRunState.STALE:
return (
<Tooltip
Expand Down Expand Up @@ -167,7 +205,7 @@ function TaskStateTag({ taskInfo }: { taskInfo: VoxelyticsTaskInfo }) {
<Tag icon={<CloseCircleOutlined />} color="error">
failed
</Tag>{" "}
{moment(taskInfo.endTime).fromNow()} after{" "}
{moment(taskInfo.endTime).fromNow()}, after{" "}
{formatDistance(taskInfo.endTime, taskInfo.beginTime)}
</Tooltip>
);
Expand All @@ -185,7 +223,7 @@ function TaskStateTag({ taskInfo }: { taskInfo: VoxelyticsTaskInfo }) {
<Tag icon={<CheckCircleOutlined />} color="success">
completed
</Tag>{" "}
{moment(taskInfo.endTime).fromNow()}{" "}
{moment(taskInfo.endTime).fromNow()},{" "}
{formatDistance(taskInfo.endTime, taskInfo.beginTime)}
</Tooltip>
);
Expand Down

0 comments on commit 84487fd

Please sign in to comment.