-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear Job#finished_time when it is opened (#32605) #32755
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,11 +51,9 @@ | |
import org.elasticsearch.threadpool.ThreadPool; | ||
import org.elasticsearch.transport.TransportService; | ||
import org.elasticsearch.xpack.core.XPackField; | ||
import org.elasticsearch.xpack.core.XPackPlugin; | ||
import org.elasticsearch.xpack.core.ml.MlMetaIndex; | ||
import org.elasticsearch.xpack.core.ml.MlMetadata; | ||
import org.elasticsearch.xpack.core.ml.MlTasks; | ||
import org.elasticsearch.xpack.core.ml.action.FinalizeJobExecutionAction; | ||
import org.elasticsearch.xpack.core.ml.action.OpenJobAction; | ||
import org.elasticsearch.xpack.core.ml.action.PutJobAction; | ||
import org.elasticsearch.xpack.core.ml.action.UpdateJobAction; | ||
|
@@ -75,7 +73,6 @@ | |
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.Date; | ||
import java.util.LinkedList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
@@ -480,7 +477,7 @@ protected void masterOperation(OpenJobAction.Request request, ClusterState state | |
// Step 6. Clear job finished time once the job is started and respond | ||
ActionListener<OpenJobAction.Response> clearJobFinishTime = ActionListener.wrap( | ||
response -> { | ||
if(response.isAcknowledged()) { | ||
if (response.isAcknowledged()) { | ||
clearJobFinishedTime(jobParams.getJobId(), listener); | ||
} else { | ||
listener.onResponse(response); | ||
|
@@ -593,10 +590,9 @@ public void onTimeout(TimeValue timeout) { | |
} | ||
|
||
private void clearJobFinishedTime(String jobId, ActionListener<OpenJobAction.Response> listener) { | ||
clusterService.submitStateUpdateTask("clearing_job_finish_time [" + jobId + "]", new ClusterStateUpdateTask() { | ||
clusterService.submitStateUpdateTask("clearing-job-finish-time [" + jobId + "]", new ClusterStateUpdateTask() { | ||
@Override | ||
public ClusterState execute(ClusterState currentState) { | ||
XPackPlugin.checkReadyForXPackCustomMetadata(currentState); | ||
MlMetadata mlMetadata = MlMetadata.getMlMetadata(currentState); | ||
MlMetadata.Builder mlMetadataBuilder = new MlMetadata.Builder(mlMetadata); | ||
Job.Builder jobBuilder = new Job.Builder(mlMetadata.getJobs().get(jobId)); | ||
|
@@ -611,7 +607,8 @@ public ClusterState execute(ClusterState currentState) { | |
|
||
@Override | ||
public void onFailure(String source, Exception e) { | ||
listener.onFailure(e); | ||
logger.error(source + "Failed to clear finished_time due to [" + e.getMessage() + "]", e); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We tend to start the messages with the job_id. So, this could become:
|
||
listener.onResponse(new OpenJobAction.Response(true)); | ||
} | ||
|
||
@Override | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
package org.elasticsearch.xpack.ml.integration; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing license header |
||
|
||
import org.elasticsearch.xpack.core.ml.job.config.AnalysisConfig; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry for insisting on that but so that task names are consistent (should make it easier to search through them) could you change to
"clearing-finish-time-for-job-" + jobId
?