private TaskProgress buildTaskProgress(
            final long timeNowMs,
            final TaskContextImpl taskContext) {

        final UserRef userRef;
        final UserIdentity userIdentity = taskContext.getUserIdentity();
        if (userIdentity instanceof final HasUserRef hasUserRef) {
            userRef = hasUserRef.getUserRef();
        } else {
            userRef = UserRef.builder().subjectId(userIdentity.getSubjectId()).build();
        }

        final TaskProgress taskProgress = new TaskProgress();
        taskProgress.setId(taskContext.getTaskId());
        taskProgress.setTaskName(taskContext.getName());
        taskProgress.setUserRef(userRef);
        taskProgress.setThreadName(taskContext.getThreadName());
        taskProgress.setTaskInfo(taskContext.getInfo());
        taskProgress.setSubmitTimeMs(taskContext.getSubmitTimeMs());
        taskProgress.setTimeNowMs(timeNowMs);
        taskProgress.setNodeName(thisNodeName);
        return taskProgress;
    }
Tells tasks to terminate and waits for all tasks to terminate before
cleaning up the executors.
stroom-task/stroom-task-impl/src/main/java/stroom/task/impl/TaskManagerImpl.java