YARN-8830. SLS tool fix node addition. Contributed by Bibin A Chundatt.

(cherry picked from commit b4a38e7b3e)
This commit is contained in:
bibinchundatt 2018-10-15 16:10:25 +05:30
parent 8a41edb089
commit aff21d7271
1 changed files with 29 additions and 0 deletions

View File

@ -45,6 +45,8 @@ import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.collections.SetUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration;
@ -1029,5 +1031,32 @@ public class SLSRunner extends Configured implements Tool {
public void setLabels(Set<NodeLabel> labels) {
this.labels = labels;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof NodeDetails)) {
return false;
}
NodeDetails that = (NodeDetails) o;
return StringUtils.equals(hostname, that.hostname) && (
nodeResource == null ?
that.nodeResource == null :
nodeResource.equals(that.nodeResource)) && SetUtils
.isEqualSet(labels, that.labels);
}
@Override
public int hashCode() {
int result = hostname == null ? 0 : hostname.hashCode();
result =
31 * result + (nodeResource == null ? 0 : nodeResource.hashCode());
result = 31 * result + (labels == null ? 0 : labels.hashCode());
return result;
}
}
}