Skip to content

Commit

Permalink
[ML] Replace Version.CURRENT in streaming functions (#36118)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Dec 3, 2018
1 parent f048c52 commit fd1e6d4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public JobParams(String jobId) {
public JobParams(StreamInput in) throws IOException {
jobId = in.readString();
timeout = TimeValue.timeValueMillis(in.readVLong());
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
job = in.readOptionalWriteable(Job::new);
}
}
Expand Down Expand Up @@ -213,7 +213,7 @@ public String getWriteableName() {
public void writeTo(StreamOutput out) throws IOException {
out.writeString(jobId);
out.writeVLong(timeout.millis());
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeOptionalWriteable(job);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public DatafeedParams(StreamInput in) throws IOException {
startTime = in.readVLong();
endTime = in.readOptionalLong();
timeout = TimeValue.timeValueMillis(in.readVLong());
if (in.getVersion().onOrAfter(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
jobId = in.readOptionalString();
datafeedIndices = in.readList(StreamInput::readString);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeVLong(startTime);
out.writeOptionalLong(endTime);
out.writeVLong(timeout.millis());
if (out.getVersion().onOrAfter(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeOptionalString(jobId);
out.writeStringList(datafeedIndices);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ public void readFrom(StreamInput in) throws IOException {
} else {
isInternal = false;
}
// TODO jindex change CURRENT to specific version when feature branch is merged
if (in.getVersion().onOrAfter(Version.V_6_3_0) && in.getVersion().before(Version.CURRENT)) {
if (in.getVersion().onOrAfter(Version.V_6_3_0) && in.getVersion().before(Version.V_7_0_0)) {
in.readBoolean(); // was waitForAck
}
}
Expand All @@ -111,8 +110,7 @@ public void writeTo(StreamOutput out) throws IOException {
if (out.getVersion().onOrAfter(Version.V_6_2_2)) {
out.writeBoolean(isInternal);
}
// TODO jindex change CURRENT to specific version when feature branch is merged
if (out.getVersion().onOrAfter(Version.V_6_3_0) && out.getVersion().before(Version.CURRENT)) {
if (out.getVersion().onOrAfter(Version.V_6_3_0) && out.getVersion().before(Version.V_7_0_0)) {
out.writeBoolean(false); // was waitForAck
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ public Builder setModelSnapshotMinVersion(Version modelSnapshotMinVersion) {
return this;
}

public Builder setModelSnapshotMinVersion(String modelSnapshotMinVersion) {
Builder setModelSnapshotMinVersion(String modelSnapshotMinVersion) {
this.modelSnapshotMinVersion = Version.fromString(modelSnapshotMinVersion);
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,16 @@ public JobUpdate(StreamInput in) throws IOException {
} else {
jobVersion = null;
}
if (in.getVersion().onOrAfter(Version.V_6_6_0)) {
clearJobFinishTime = in.readOptionalBoolean();
} else {
clearJobFinishTime = null;
}
if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) {
modelSnapshotMinVersion = Version.readVersion(in);
} else {
modelSnapshotMinVersion = null;
}
if (in.getVersion().onOrAfter(Version.CURRENT)) { // NORELEASE change current to Jindex release version
clearJobFinishTime = in.readOptionalBoolean();
} else {
clearJobFinishTime = null;
}
}

@Override
Expand Down Expand Up @@ -188,6 +188,9 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(false);
}
}
if (out.getVersion().onOrAfter(Version.V_6_6_0)) {
out.writeOptionalBoolean(clearJobFinishTime);
}
if (out.getVersion().onOrAfter(Version.V_7_0_0)) {
if (modelSnapshotMinVersion != null) {
out.writeBoolean(true);
Expand All @@ -196,9 +199,6 @@ public void writeTo(StreamOutput out) throws IOException {
out.writeBoolean(false);
}
}
if (out.getVersion().onOrAfter(Version.CURRENT)) { // NORELEASE change current to Jindex release version
out.writeOptionalBoolean(clearJobFinishTime);
}
}

public String getJobId() {
Expand Down

0 comments on commit fd1e6d4

Please sign in to comment.