Skip to content

Commit 7fbaa7d

Browse files
committed
YARN-9476. [YARN-9473] Create unit tests for VE plugin. Contributed by Peter Bacsko.
1 parent 24f218a commit 7fbaa7d

File tree

2 files changed

+419
-2
lines changed
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src
    • main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/com/nec
    • test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/com/nec

2 files changed

+419
-2
lines changed

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/resourceplugin/com/nec/NECVEPlugin.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public NECVEPlugin() throws ResourceHandlerException {
7474
if (envScriptName != null) {
7575
binaryName = envScriptName;
7676
}
77-
LOG.info("Use {} as script name.", envScriptName);
77+
LOG.info("Use {} as script name.", binaryName);
7878

7979
// Try to find the script based on an environment variable, if set
8080
boolean found = false;
@@ -115,11 +115,13 @@ public NECVEPlugin() throws ResourceHandlerException {
115115
}
116116
}
117117

118+
@Override
118119
public DeviceRegisterRequest getRegisterRequestInfo() {
119120
return DeviceRegisterRequest.Builder.newInstance()
120121
.setResourceName("nec.com/ve").build();
121122
}
122123

124+
@Override
123125
public Set<Device> getDevices() {
124126
Set<Device> devices = null;
125127

@@ -135,6 +137,7 @@ public Set<Device> getDevices() {
135137
return devices;
136138
}
137139

140+
@Override
138141
public DeviceRuntimeSpec onDevicesAllocated(Set<Device> set,
139142
YarnRuntimeType yarnRuntimeType) {
140143
return null;
@@ -151,6 +154,7 @@ private Set<Device> parseOutput(String output) {
151154

152155
LOG.info("Parsing output: {}", output);
153156
String[] lines = output.split("\n");
157+
outer:
154158
for (String line : lines) {
155159
Device.Builder builder = Device.Builder.newInstance();
156160

@@ -163,7 +167,7 @@ private Set<Device> parseOutput(String output) {
163167
String[] tokens = keyValue.trim().split("=");
164168
if (tokens.length != 2) {
165169
LOG.error("Unknown format of script output! Skipping this line");
166-
continue;
170+
continue outer;
167171
}
168172

169173
final String key = tokens[0];

0 commit comments

Comments
 (0)