Skip to content

Commit 5239860

Browse files
committed
Fix Arcadia compute list order by the workspace and name
1 parent 54a043c commit 5239860

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Utils/hdinsight-node-common/src/com/microsoft/azure/projectarcadia/common/ArcadiaSparkCompute.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package com.microsoft.azure.projectarcadia.common;
2424

2525
import com.microsoft.azure.hdinsight.common.logger.ILogger;
26+
import com.microsoft.azure.hdinsight.sdk.cluster.ComparableCluster;
2627
import com.microsoft.azure.hdinsight.sdk.cluster.SparkCluster;
2728
import com.microsoft.azure.hdinsight.sdk.rest.azure.projectarcadia.models.SparkCompute;
2829
import com.microsoft.azure.hdinsight.sdk.rest.azure.projectarcadia.models.SparkComputeProvisioningState;
@@ -153,4 +154,22 @@ public SparkSubmitStorageType getDefaultStorageType() {
153154
public ArcadiaWorkSpace getWorkSpace() {
154155
return workSpace;
155156
}
157+
158+
@Override
159+
public int compareTo(@NotNull ComparableCluster other) {
160+
if (this == other) {
161+
return 0;
162+
}
163+
164+
final ArcadiaSparkCompute another = (ArcadiaSparkCompute) other;
165+
166+
// Compare the workspace name firstly
167+
final int workspaceCmpResult = this.workSpace.getName().compareToIgnoreCase(another.workSpace.getName());
168+
if (workspaceCmpResult != 0) {
169+
return workspaceCmpResult;
170+
}
171+
172+
// Then, the compute name
173+
return this.getName().compareToIgnoreCase(another.getName());
174+
}
156175
}

0 commit comments

Comments
 (0)