[ML] Add more trace logging around job task cancelling

Original commit: elastic/x-pack-elasticsearch@3143c39b6e
This commit is contained in:
Dimitris Athanasiou 2018-04-06 10:56:39 +01:00
parent ed6a6af64c
commit d340cd5a00
2 changed files with 6 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import org.elasticsearch.common.CheckedSupplier;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableOpenMap;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.logging.Loggers;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentBuilder;
@ -697,6 +698,8 @@ public class TransportOpenJobAction extends TransportMasterNodeAction<OpenJobAct
public static class JobTask extends AllocatedPersistentTask implements OpenJobAction.JobTaskMatcher {
private static final Logger LOGGER = Loggers.getLogger(JobTask.class);
private final String jobId;
private volatile AutodetectProcessManager autodetectProcessManager;
@ -712,6 +715,7 @@ public class TransportOpenJobAction extends TransportMasterNodeAction<OpenJobAct
@Override
protected void onCancelled() {
String reason = getReasonCancelled();
LOGGER.trace("[{}] Cancelling job task because: {}", jobId, reason);
killJob(reason);
}

View File

@ -147,6 +147,7 @@ public class AutodetectProcessManager extends AbstractComponent {
}
public void killProcess(JobTask jobTask, boolean awaitCompletion, String reason) {
logger.trace("[{}] Killing process: awaitCompletion = [{}]; reason = [{}]", jobTask.getJobId(), awaitCompletion, reason);
ProcessContext processContext = processByAllocation.remove(jobTask.getAllocationId());
if (processContext != null) {
processContext.newKillBuilder()
@ -160,6 +161,7 @@ public class AutodetectProcessManager extends AbstractComponent {
// causing the task to be recreated but the failed process wasn't.
// We still need to remove the task from the TaskManager (which
// is what the kill would do)
logger.trace("[{}] Marking job task as completed", jobTask.getJobId());
jobTask.markAsCompleted();
}
}