diff --git a/classification/src/main/java/dev/ikm/komet/reasoner/ReasonerResultsNode.java b/classification/src/main/java/dev/ikm/komet/reasoner/ReasonerResultsNode.java index 65b0daf2f..3eb8442e1 100644 --- a/classification/src/main/java/dev/ikm/komet/reasoner/ReasonerResultsNode.java +++ b/classification/src/main/java/dev/ikm/komet/reasoner/ReasonerResultsNode.java @@ -260,10 +260,11 @@ private void runFullReasonerRemotely(RemoteReasonerService remoteReasonerService Thread.currentThread().interrupt(); LOG.info(ie.getMessage(), ie); } catch (CancellationException ce) { - // Cancels the local wait only: the server keeps classifying, because the RPC has - // no cancellation hook yet. The user stops watching, not the work. - LOG.info(ce.getMessage(), ce); - task.updateMessage("Stopped waiting for the remote reasoner"); + // Stops the run on the server, not just the wait: cancelling the task is what the + // remote client watches for, and it then asks the server to cancel. Expected, so + // logged without a stack trace. + LOG.info("Remote reasoner cancelled"); + task.updateMessage("Cancelled full reasoner"); task.cancel(); ProgressHelper.cancel(javafxTask); } diff --git a/classification/src/main/java/dev/ikm/komet/reasoner/ui/RunRemoteReasonerTask.java b/classification/src/main/java/dev/ikm/komet/reasoner/ui/RunRemoteReasonerTask.java index f655f190c..113a08912 100644 --- a/classification/src/main/java/dev/ikm/komet/reasoner/ui/RunRemoteReasonerTask.java +++ b/classification/src/main/java/dev/ikm/komet/reasoner/ui/RunRemoteReasonerTask.java @@ -68,7 +68,9 @@ protected RemoteReasonerService.RemoteReasonerOutcome compute() throws Exception reasonerService.runFullReasoner((step, totalSteps, message) -> { updateMessage("Step " + step + " of " + totalSteps + ": " + message); updateProgress(step, totalSteps); - }); + }, this); + // this, as the tracker: Komet's cancel calls cancel() on this task, and the remote + // service watches it to stop the classification server-side. updateMessage("Reasoner run complete in " + durationString()); if (outcomeConsumer != null) { outcomeConsumer.accept(outcome); diff --git a/framework/src/main/java/dev/ikm/komet/framework/concurrent/TaskWrapper.java b/framework/src/main/java/dev/ikm/komet/framework/concurrent/TaskWrapper.java index eb2ef1b2f..2a97a28e8 100644 --- a/framework/src/main/java/dev/ikm/komet/framework/concurrent/TaskWrapper.java +++ b/framework/src/main/java/dev/ikm/komet/framework/concurrent/TaskWrapper.java @@ -112,6 +112,10 @@ private void handleRetention() { @Override protected void cancelled() { this.trackingCallable.cancel(); + // Removed as succeeded() and failed() do: left in executingTasks, a cancelled task keeps + // the Activity indicator spinning forever. + TaskListsService.get().pendingTasks().remove(this); + TaskListsService.get().executingTasks().remove(this); } @Override diff --git a/pom.xml b/pom.xml index eb95c9e66..e9bb91bb8 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ dev.ikm.komet komet-parent KOMET - 1.59.5-SNAPSHOT + 1.59.5-reasoner_cancel-SNAPSHOT pom 2015