Skip to content

Commit

Permalink
Remove references to 7.6 and 7.7 transport versions from ML model code (
Browse files Browse the repository at this point in the history
  • Loading branch information
thecoop authored Dec 16, 2024
1 parent bb8503a commit 6453a66
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ static TransportVersion def(int id) {
public static final TransportVersion V_7_3_0 = def(7_03_00_99);
public static final TransportVersion V_7_4_0 = def(7_04_00_99);
public static final TransportVersion V_7_6_0 = def(7_06_00_99);
public static final TransportVersion V_7_7_0 = def(7_07_00_99);
public static final TransportVersion V_7_8_0 = def(7_08_00_99);
public static final TransportVersion V_7_8_1 = def(7_08_01_99);
public static final TransportVersion V_7_9_0 = def(7_09_00_99);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class ClassificationConfig implements LenientlyParsedInferenceConfig, Str
public static final ParseField NUM_TOP_FEATURE_IMPORTANCE_VALUES = new ParseField("num_top_feature_importance_values");
public static final ParseField PREDICTION_FIELD_TYPE = new ParseField("prediction_field_type");
private static final MlConfigVersion MIN_SUPPORTED_VERSION = MlConfigVersion.V_7_6_0;
private static final TransportVersion MIN_SUPPORTED_TRANSPORT_VERSION = TransportVersions.V_7_6_0;

public static ClassificationConfig EMPTY_PARAMS = new ClassificationConfig(
0,
Expand Down Expand Up @@ -227,7 +226,7 @@ public MlConfigVersion getMinimalSupportedMlConfigVersion() {

@Override
public TransportVersion getMinimalSupportedTransportVersion() {
return requestingImportance() ? TransportVersions.V_7_7_0 : MIN_SUPPORTED_TRANSPORT_VERSION;
return TransportVersions.ZERO;
}

public static Builder builder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class RegressionConfig implements LenientlyParsedInferenceConfig, Strictl

public static final ParseField NAME = new ParseField("regression");
private static final MlConfigVersion MIN_SUPPORTED_VERSION = MlConfigVersion.V_7_6_0;
private static final TransportVersion MIN_SUPPORTED_TRANSPORT_VERSION = TransportVersions.V_7_6_0;
public static final ParseField NUM_TOP_FEATURE_IMPORTANCE_VALUES = new ParseField("num_top_feature_importance_values");

public static RegressionConfig EMPTY_PARAMS = new RegressionConfig(DEFAULT_RESULTS_FIELD, null);
Expand Down Expand Up @@ -160,7 +159,7 @@ public MlConfigVersion getMinimalSupportedMlConfigVersion() {

@Override
public TransportVersion getMinimalSupportedTransportVersion() {
return requestingImportance() ? TransportVersions.V_7_7_0 : MIN_SUPPORTED_TRANSPORT_VERSION;
return TransportVersions.ZERO;
}

public static Builder builder() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public interface TrainedModel extends NamedXContentObject, NamedWriteable, Accou
long estimatedNumOperations();

default TransportVersion getMinimalCompatibilityVersion() {
return TransportVersions.V_7_6_0;
return TransportVersions.ZERO;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ public TransportVersion getMinimalCompatibilityVersion() {
return models.stream()
.map(TrainedModel::getMinimalCompatibilityVersion)
.max(TransportVersion::compareTo)
.orElse(TransportVersions.V_7_6_0);
.orElse(TransportVersions.ZERO);
}

public static class Builder {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import org.apache.lucene.util.Accountable;
import org.apache.lucene.util.Accountables;
import org.apache.lucene.util.RamUsageEstimator;
import org.elasticsearch.TransportVersion;
import org.elasticsearch.TransportVersions;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -287,14 +285,6 @@ public Collection<Accountable> getChildResources() {
return Collections.unmodifiableCollection(accountables);
}

@Override
public TransportVersion getMinimalCompatibilityVersion() {
if (nodes.stream().filter(TreeNode::isLeaf).anyMatch(t -> t.getLeafValue().length > 1)) {
return TransportVersions.V_7_7_0;
}
return TransportVersions.V_7_6_0;
}

public static final class Builder {
private List<String> featureNames;
private ArrayList<TreeNode.Builder> nodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ public TransformState(StreamInput in) throws IOException {
reason = in.readOptionalString();
progress = in.readOptionalWriteable(TransformProgress::new);
node = in.readOptionalWriteable(NodeAttributes::new);
if (in.getTransportVersion().onOrAfter(TransportVersions.V_7_6_0)) {
shouldStopAtNextCheckpoint = in.readBoolean();
} else {
shouldStopAtNextCheckpoint = false;
}
shouldStopAtNextCheckpoint = in.readBoolean();
if (in.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
authState = in.readOptionalWriteable(AuthorizationState::new);
} else {
Expand Down Expand Up @@ -237,9 +233,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(reason);
out.writeOptionalWriteable(progress);
out.writeOptionalWriteable(node);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_7_6_0)) {
out.writeBoolean(shouldStopAtNextCheckpoint);
}
out.writeBoolean(shouldStopAtNextCheckpoint);
if (out.getTransportVersion().onOrAfter(TransportVersions.V_8_8_0)) {
out.writeOptionalWriteable(authState);
}
Expand Down

0 comments on commit 6453a66

Please sign in to comment.