Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,22 @@ public int hashCode() {
private final Instant startTime;
private final List<AssignmentStats.NodeStats> nodeStats;

public AssignmentStats(AssignmentStats other) {
this.deploymentId = other.deploymentId;
this.modelId = other.modelId;
this.threadsPerAllocation = other.threadsPerAllocation;
this.numberOfAllocations = other.numberOfAllocations;
this.adaptiveAllocationsSettings = other.adaptiveAllocationsSettings;
this.queueCapacity = other.queueCapacity;
this.startTime = other.startTime;
this.nodeStats = other.nodeStats;
this.state = other.state;
this.reason = other.reason;
this.allocationStatus = other.allocationStatus;
this.cacheSize = other.cacheSize;
this.priority = other.priority;
}

public AssignmentStats(
String deploymentId,
String modelId,
Expand Down Expand Up @@ -535,6 +551,12 @@ public AssignmentState getState() {
return state;
}

public AssignmentStats setNodeStats(List<AssignmentStats.NodeStats> nodeStats) {
this.nodeStats.clear();
this.nodeStats.addAll(nodeStats);
return this;
}

public AssignmentStats setState(AssignmentState state) {
this.state = state;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ public void testGetOverallInferenceStatsWithOnlyStoppedNodes() {
assertThat(stats.getFailureCount(), equalTo(0L));
}

public void testCopyConstructor() {
AssignmentStats original = randomDeploymentStats();
AssignmentStats copy = new AssignmentStats(original);
assertThat(copy, equalTo(original));
}

@Override
protected Writeable.Reader<AssignmentStats> instanceReader() {
return AssignmentStats::new;
Expand Down