YARN-1661. Fixed DS ApplicationMaster to write the correct exit log. Contributed by Vinod Kumar Vavilapalli.
svn merge --ignore-ancestry -c 1565394 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1565397 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cf173a332b
commit
e05f49778b
|
@ -604,6 +604,9 @@ Release 2.3.0 - UNRELEASED
|
||||||
YARN-1628. Fixed the test failure in TestContainerManagerSecurity. (Vinod
|
YARN-1628. Fixed the test failure in TestContainerManagerSecurity. (Vinod
|
||||||
Kumar Vavilapalli via zjshen)
|
Kumar Vavilapalli via zjshen)
|
||||||
|
|
||||||
|
YARN-1661. Fixed DS ApplicationMaster to write the correct exit log. (Vinod
|
||||||
|
Kumar Vavilapalli via zjshen)
|
||||||
|
|
||||||
Release 2.2.0 - 2013-10-13
|
Release 2.2.0 - 2013-10-13
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -232,7 +232,6 @@ public class ApplicationMaster {
|
||||||
private static final String shellArgsPath = "shellArgs";
|
private static final String shellArgsPath = "shellArgs";
|
||||||
|
|
||||||
private volatile boolean done;
|
private volatile boolean done;
|
||||||
private volatile boolean success;
|
|
||||||
|
|
||||||
private ByteBuffer allTokens;
|
private ByteBuffer allTokens;
|
||||||
|
|
||||||
|
@ -254,8 +253,8 @@ public class ApplicationMaster {
|
||||||
if (!doRun) {
|
if (!doRun) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
result = appMaster.run();
|
appMaster.run();
|
||||||
appMaster.finish();
|
result = appMaster.finish();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOG.fatal("Error running ApplicationMaster", t);
|
LOG.fatal("Error running ApplicationMaster", t);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
@ -480,7 +479,7 @@ public class ApplicationMaster {
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public boolean run() throws YarnException, IOException {
|
public void run() throws YarnException, IOException {
|
||||||
LOG.info("Starting ApplicationMaster");
|
LOG.info("Starting ApplicationMaster");
|
||||||
|
|
||||||
Credentials credentials =
|
Credentials credentials =
|
||||||
|
@ -561,7 +560,6 @@ public class ApplicationMaster {
|
||||||
amRMClient.addContainerRequest(containerAsk);
|
amRMClient.addContainerRequest(containerAsk);
|
||||||
}
|
}
|
||||||
numRequestedContainers.set(numTotalContainersToRequest);
|
numRequestedContainers.set(numTotalContainersToRequest);
|
||||||
return success;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
|
@ -569,7 +567,8 @@ public class ApplicationMaster {
|
||||||
return new NMCallbackHandler(this);
|
return new NMCallbackHandler(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void finish() {
|
@VisibleForTesting
|
||||||
|
protected boolean finish() {
|
||||||
// wait for completion.
|
// wait for completion.
|
||||||
while (!done
|
while (!done
|
||||||
&& (numCompletedContainers.get() != numTotalContainers)) {
|
&& (numCompletedContainers.get() != numTotalContainers)) {
|
||||||
|
@ -600,7 +599,7 @@ public class ApplicationMaster {
|
||||||
|
|
||||||
FinalApplicationStatus appStatus;
|
FinalApplicationStatus appStatus;
|
||||||
String appMessage = null;
|
String appMessage = null;
|
||||||
success = true;
|
boolean success = true;
|
||||||
if (numFailedContainers.get() == 0 &&
|
if (numFailedContainers.get() == 0 &&
|
||||||
numCompletedContainers.get() == numTotalContainers) {
|
numCompletedContainers.get() == numTotalContainers) {
|
||||||
appStatus = FinalApplicationStatus.SUCCEEDED;
|
appStatus = FinalApplicationStatus.SUCCEEDED;
|
||||||
|
@ -621,6 +620,8 @@ public class ApplicationMaster {
|
||||||
}
|
}
|
||||||
|
|
||||||
amRMClient.stop();
|
amRMClient.stop();
|
||||||
|
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RMCallbackHandler implements AMRMClientAsync.CallbackHandler {
|
private class RMCallbackHandler implements AMRMClientAsync.CallbackHandler {
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
|
|
||||||
package org.apache.hadoop.yarn.applications.distributedshell;
|
package org.apache.hadoop.yarn.applications.distributedshell;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class ContainerLaunchFailAppMaster extends ApplicationMaster {
|
public class ContainerLaunchFailAppMaster extends ApplicationMaster {
|
||||||
|
|
||||||
private static final Log LOG =
|
private static final Log LOG =
|
||||||
|
@ -66,8 +66,8 @@ public class ContainerLaunchFailAppMaster extends ApplicationMaster {
|
||||||
if (!doRun) {
|
if (!doRun) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
result = appMaster.run();
|
appMaster.run();
|
||||||
appMaster.finish();
|
result = appMaster.finish();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
LOG.fatal("Error running ApplicationMaster", t);
|
LOG.fatal("Error running ApplicationMaster", t);
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
|
|
@ -29,8 +29,8 @@ public class TestDSFailedAppMaster extends ApplicationMaster {
|
||||||
private static final Log LOG = LogFactory.getLog(TestDSFailedAppMaster.class);
|
private static final Log LOG = LogFactory.getLog(TestDSFailedAppMaster.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run() throws YarnException, IOException {
|
public void run() throws YarnException, IOException {
|
||||||
boolean res = super.run();
|
super.run();
|
||||||
|
|
||||||
// for the 2nd attempt.
|
// for the 2nd attempt.
|
||||||
if (appAttemptID.getAttemptId() == 2) {
|
if (appAttemptID.getAttemptId() == 2) {
|
||||||
|
@ -39,11 +39,12 @@ public class TestDSFailedAppMaster extends ApplicationMaster {
|
||||||
// numRequestedContainers should be set to 0.
|
// numRequestedContainers should be set to 0.
|
||||||
if (numAllocatedContainers.get() != 1
|
if (numAllocatedContainers.get() != 1
|
||||||
|| numRequestedContainers.get() != 0) {
|
|| numRequestedContainers.get() != 0) {
|
||||||
LOG.info("Application Master failed. exiting");
|
LOG.info("NumAllocatedContainers is " + numAllocatedContainers.get()
|
||||||
|
+ " and NumRequestedContainers is " + numAllocatedContainers.get()
|
||||||
|
+ ".Application Master failed. exiting");
|
||||||
System.exit(200);
|
System.exit(200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -54,7 +55,7 @@ public class TestDSFailedAppMaster extends ApplicationMaster {
|
||||||
if (!doRun) {
|
if (!doRun) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
result = appMaster.run();
|
appMaster.run();
|
||||||
if (appMaster.appAttemptID.getAttemptId() == 1) {
|
if (appMaster.appAttemptID.getAttemptId() == 1) {
|
||||||
try {
|
try {
|
||||||
// sleep some time, wait for the AM to launch a container.
|
// sleep some time, wait for the AM to launch a container.
|
||||||
|
@ -63,7 +64,7 @@ public class TestDSFailedAppMaster extends ApplicationMaster {
|
||||||
// fail the first am.
|
// fail the first am.
|
||||||
System.exit(100);
|
System.exit(100);
|
||||||
}
|
}
|
||||||
appMaster.finish();
|
result = appMaster.finish();
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue