Skip to content
Open
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 @@ -37,6 +37,7 @@
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
import org.apache.hadoop.yarn.api.records.ApplicationId;
Expand Down Expand Up @@ -516,17 +517,17 @@ void generateScript(File localScript) throws IOException {
for (AppInfo context : eligibleApplications) {
fw.write("if [ \"$YARN_SHELL_ID\" == \"");
fw.write(Integer.toString(containerCount));
fw.write("\" ]; then\n\tappId=\"");
fw.write(context.getAppId());
fw.write("\"\n\tuser=\"");
fw.write(context.getUser());
fw.write("\"\n\tworkingDir=\"");
fw.write(context.getWorkingDir().toString());
fw.write("\"\n\tremoteRootLogDir=\"");
fw.write(context.getRemoteRootLogDir().toString());
fw.write("\"\n\tsuffix=\"");
fw.write(context.getSuffix());
fw.write("\"\nel");
fw.write("\" ]; then\n\tappId=");
fw.write(Shell.bashQuote(context.getAppId()));
fw.write("\n\tuser=");
fw.write(Shell.bashQuote(context.getUser()));
fw.write("\n\tworkingDir=");
fw.write(Shell.bashQuote(context.getWorkingDir().toString()));
fw.write("\n\tremoteRootLogDir=");
fw.write(Shell.bashQuote(context.getRemoteRootLogDir().toString()));
fw.write("\n\tsuffix=");
fw.write(Shell.bashQuote(context.getSuffix()));
fw.write("\nel");
containerCount++;
}
fw.write("se\n\techo \"Unknown Mapping!\"\n\texit 1\nfi\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,32 +297,31 @@ private void _testGenerateScript(boolean proxy) throws Exception {
assertEquals("if [ \"$YARN_SHELL_ID\" == \"1\" ]; then", lines[3]);
boolean oneBefore = true;
if (lines[4].contains(app1.toString())) {
assertEquals("\tappId=\"" + app1.toString() + "\"", lines[4]);
assertEquals("\tappId=\"" + app2.toString() + "\"", lines[10]);
assertEquals("\tappId=" + Shell.bashQuote(app1.toString()), lines[4]);
assertEquals("\tappId=" + Shell.bashQuote(app2.toString()), lines[10]);
} else {
oneBefore = false;
assertEquals("\tappId=\"" + app2.toString() + "\"", lines[4]);
assertEquals("\tappId=\"" + app1.toString() + "\"", lines[10]);
assertEquals("\tappId=" + Shell.bashQuote(app2.toString()), lines[4]);
assertEquals("\tappId=" + Shell.bashQuote(app1.toString()), lines[10]);
}
assertEquals("\tuser=\"" + USER + "\"", lines[5]);
assertEquals("\tworkingDir=\"" + (oneBefore ? workingDir.toString()
: workingDir2.toString()) + "\"", lines[6]);
assertEquals("\tremoteRootLogDir=\"" + (oneBefore
? remoteRootLogDir.toString() : remoteRootLogDir2.toString())
+ "\"", lines[7]);
assertEquals("\tsuffix=\"" + (oneBefore ? suffix : suffix2)
+ "\"", lines[8]);
assertEquals("\tuser=" + Shell.bashQuote(USER), lines[5]);
assertEquals("\tworkingDir=" + Shell.bashQuote(oneBefore
? workingDir.toString() : workingDir2.toString()), lines[6]);
assertEquals("\tremoteRootLogDir=" + Shell.bashQuote(oneBefore
? remoteRootLogDir.toString() : remoteRootLogDir2.toString()),
lines[7]);
assertEquals("\tsuffix=" + Shell.bashQuote(oneBefore ? suffix : suffix2),
lines[8]);
assertEquals("elif [ \"$YARN_SHELL_ID\" == \"2\" ]; then",
lines[9]);
assertEquals("\tuser=\"" + USER + "\"", lines[11]);
assertEquals("\tworkingDir=\"" + (oneBefore
? workingDir2.toString() : workingDir.toString()) + "\"",
lines[12]);
assertEquals("\tremoteRootLogDir=\"" + (oneBefore
? remoteRootLogDir2.toString() : remoteRootLogDir.toString())
+ "\"", lines[13]);
assertEquals("\tsuffix=\"" + (oneBefore ? suffix2 : suffix)
+ "\"", lines[14]);
assertEquals("\tuser=" + Shell.bashQuote(USER), lines[11]);
assertEquals("\tworkingDir=" + Shell.bashQuote(oneBefore
? workingDir2.toString() : workingDir.toString()), lines[12]);
assertEquals("\tremoteRootLogDir=" + Shell.bashQuote(oneBefore
? remoteRootLogDir2.toString() : remoteRootLogDir.toString()),
lines[13]);
assertEquals("\tsuffix=" + Shell.bashQuote(oneBefore ? suffix2 : suffix),
lines[14]);
assertEquals("else", lines[15]);
assertEquals("\techo \"Unknown Mapping!\"", lines[16]);
assertEquals("\texit 1", lines[17]);
Expand Down
Loading