Skip to content

Commit

Permalink
Add jobJarUrl to UpdateJobClusterArtifactRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
kmg-stripe committed Sep 6, 2024
1 parent b1561a5 commit 9b709f8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2178,7 +2178,7 @@ public void onJobClusterUpdateArtifact(UpdateJobClusterArtifactRequest artifactR
return;
}
JobClusterConfig newConfig = new JobClusterConfig.Builder().from(jobClusterMetadata.getJobClusterDefinition().getJobClusterConfig())
// TODO(swada): do we need to add jobJarURL to UpdateJobClusterArtifactRequest as well?
.withJobJarUrl(artifactReq.getjobJarUrl())
.withArtifactName(artifactReq.getArtifactName())
.withVersion(artifactReq.getVersion())
.withUploadedAt(System.currentTimeMillis())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ public UpdateSchedulingInfoRequest(

public static final class UpdateJobClusterArtifactRequest extends BaseRequest {
private final String artifactName;
private final String jobJarUrl;
private final String version;
private final boolean skipSubmit;
private final String user;
Expand All @@ -535,6 +536,7 @@ public static final class UpdateJobClusterArtifactRequest extends BaseRequest {
public UpdateJobClusterArtifactRequest(
@JsonProperty("name") final String clusterName,
@JsonProperty("url") final String artifact,
@JsonProperty("jobJarUrl") final String jobJarUrl,
@JsonProperty("version") final String version,
@JsonProperty("skipsubmit") final boolean skipSubmit,
@JsonProperty("user") final String user) {
Expand All @@ -551,6 +553,7 @@ public UpdateJobClusterArtifactRequest(

this.clusterName = clusterName;
this.artifactName = artifact;
this.jobJarUrl = jobJarUrl != null ? jobJarUrl : "http://" + artifact;
this.version = version;
this.skipSubmit = skipSubmit;
this.user = user;
Expand All @@ -560,6 +563,10 @@ public String getArtifactName() {
return artifactName;
}

public String getjobJarUrl() {
return jobJarUrl;
}

public String getVersion() {
return version;
}
Expand All @@ -580,6 +587,7 @@ public String getClusterName() {
public String toString() {
return "UpdateJobClusterArtifactRequest{" +
"artifactName='" + artifactName + '\'' +
"jobJarUrl='" + jobJarUrl + '\'' +
", version='" + version + '\'' +
", skipSubmit=" + skipSubmit +
", user='" + user + '\'' +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public static class Builder {
public Builder() {}

public Builder withJobJarUrl(String jobJarUrl) {
Preconditions.checkNotNull(jobJarUrl, "artifactName cannot be null");
Preconditions.checkArgument(!jobJarUrl.isEmpty(), "ArtifactName cannot be empty");
Preconditions.checkNotNull(jobJarUrl, "jobJarUrl cannot be null");
Preconditions.checkArgument(!jobJarUrl.isEmpty(), "jobJarUrl cannot be empty");
this.jobJarUrl = jobJarUrl;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ public void testJobClusterArtifactUpdate() throws Exception {
JobClusterProto.InitializeJobClusterResponse createResp = probe.expectMsgClass(JobClusterProto.InitializeJobClusterResponse.class);
assertEquals(SUCCESS, createResp.responseCode);

UpdateJobClusterArtifactRequest req = new UpdateJobClusterArtifactRequest(clusterName, "a1", "1.0.1", true, "user");
UpdateJobClusterArtifactRequest req = new UpdateJobClusterArtifactRequest(clusterName, "a1", "http://a1", "1.0.1", true, "user");

jobClusterActor.tell(req, probe.getRef());
UpdateJobClusterArtifactResponse resp = probe.expectMsgClass(UpdateJobClusterArtifactResponse.class);
Expand Down Expand Up @@ -814,7 +814,7 @@ public void testJobClusterArtifactUpdateNotUniqueFails() throws Exception {
JobClusterProto.InitializeJobClusterResponse createResp = probe.expectMsgClass(JobClusterProto.InitializeJobClusterResponse.class);
assertEquals(SUCCESS, createResp.responseCode);

UpdateJobClusterArtifactRequest req = new UpdateJobClusterArtifactRequest(clusterName, "a1", "0.0.1", true, "user");
UpdateJobClusterArtifactRequest req = new UpdateJobClusterArtifactRequest(clusterName, "a1", "http://a1", "0.0.1", true, "user");

jobClusterActor.tell(req, probe.getRef());
UpdateJobClusterArtifactResponse resp = probe.expectMsgClass(UpdateJobClusterArtifactResponse.class);
Expand Down Expand Up @@ -851,7 +851,7 @@ public void testJobClusterArtifactUpdateMultipleTimes() throws Exception {
JobClusterProto.InitializeJobClusterResponse createResp = probe.expectMsgClass(JobClusterProto.InitializeJobClusterResponse.class);
assertEquals(SUCCESS, createResp.responseCode);

UpdateJobClusterArtifactRequest req = new UpdateJobClusterArtifactRequest(clusterName, "a1", "1.0.1", true, "user");
UpdateJobClusterArtifactRequest req = new UpdateJobClusterArtifactRequest(clusterName, "a1", "http://a1", "1.0.1", true, "user");

jobClusterActor.tell(req, probe.getRef());
UpdateJobClusterArtifactResponse resp = probe.expectMsgClass(UpdateJobClusterArtifactResponse.class);
Expand All @@ -875,7 +875,7 @@ public void testJobClusterArtifactUpdateMultipleTimes() throws Exception {

// Update again

req = new UpdateJobClusterArtifactRequest(clusterName, "a2", "1.0.3", true, "user");
req = new UpdateJobClusterArtifactRequest(clusterName, "a2", "http:/a2", "1.0.3", true, "user");

jobClusterActor.tell(req, probe.getRef());
resp = probe.expectMsgClass(UpdateJobClusterArtifactResponse.class);
Expand Down Expand Up @@ -2058,7 +2058,7 @@ public void testUpdateJobClusterArtifactWithAutoSubmit() {
// Update artifact with skip submit = false
String artifact = "newartifact.zip";
String version = "0.0.2";
jobClusterActor.tell(new UpdateJobClusterArtifactRequest(clusterName, artifact, version,false, user), probe.getRef());
jobClusterActor.tell(new UpdateJobClusterArtifactRequest(clusterName, artifact, "http://" + artifact, version,false, user), probe.getRef());
UpdateJobClusterArtifactResponse resp = probe.expectMsgClass(UpdateJobClusterArtifactResponse.class);

// ensure new job was launched
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ public void testJobClusterArtifactUpdate() throws MalformedURLException {
UpdateJobClusterArtifactRequest req = new JobClusterManagerProto.UpdateJobClusterArtifactRequest(
clusterName,
"myjar",
"http://myjar",
"1.0.1",
true,
"user");
Expand Down

0 comments on commit 9b709f8

Please sign in to comment.