Skip to content
Merged
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 @@ -55,7 +55,8 @@
@XmlAccessorType(XmlAccessType.NONE)
@Public
@Evolving
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties(ignoreUnknown = true,
value = {"relatedEntitiesJAXB", "primaryFiltersJAXB", "otherInfoJAXB"})
public class TimelineEntity implements Comparable<TimelineEntity> {

private String entityType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@XmlAccessorType(XmlAccessType.NONE)
@Public
@Evolving
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties(ignoreUnknown = true, value = {"eventInfoJAXB"})
public class TimelineEvent implements Comparable<TimelineEvent> {

private long timestamp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
@XmlAccessorType(XmlAccessType.NONE)
@InterfaceAudience.Public
@InterfaceStability.Unstable
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties(ignoreUnknown = true,
value = {"infoJAXB", "configsJAXB", "isRelatedToEntitiesJAXB", "relatesToEntitiesJAXB"})
public class TimelineEntity implements Comparable<TimelineEntity> {
protected final static String SYSTEM_INFO_KEY_PREFIX = "SYSTEM_INFO_";
public final static long DEFAULT_ENTITY_PREFIX = 0L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.hadoop.yarn.api.records.timelineservice;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.yarn.util.TimelineServiceHelper;
Expand All @@ -38,6 +39,7 @@
@XmlAccessorType(XmlAccessType.NONE)
@InterfaceAudience.Public
@InterfaceStability.Unstable
@JsonIgnoreProperties(ignoreUnknown = true, value = {"infoJAXB"})
public class TimelineEvent implements Comparable<TimelineEvent> {
public static final long INVALID_TIMESTAMP = 0L;

Expand All @@ -61,7 +63,6 @@ public void setId(String eventId) {
// required by JAXB
@InterfaceAudience.Private
@XmlElement(name = "info")
@JsonIgnore
public HashMap<String, Object> getInfoJAXB() {
return info;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@XmlAccessorType(XmlAccessType.NONE)
@InterfaceAudience.Public
@InterfaceStability.Unstable
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonIgnoreProperties(ignoreUnknown = true, value = {"valuesJAXB"})
public class TimelineMetric {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
5 changes: 5 additions & 0 deletions hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Collections.<String, LocalResource> emptyMap(),

@After
public void teardown() throws YarnException, IOException {
if (yarnClient != null) {
if (yarnClient != null && attemptId != null) {
yarnClient.killApplication(attemptId.getApplicationId());
}
attemptId = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
import org.apache.hadoop.yarn.util.Records;
import org.junit.Assert;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Expand All @@ -94,7 +95,7 @@
@RunWith(value = Parameterized.class)
public class TestAMRMClient extends BaseAMRMClientTest{

private final static int DEFAULT_ITERATION = 3;
private final static int DEFAULT_ITERATION = 15;

public TestAMRMClient(String schedulerName, boolean autoUpdate) {
this.schedulerName = schedulerName;
Expand Down Expand Up @@ -528,7 +529,7 @@ public void testAMRMClientMatchStorage() throws YarnException, IOException {
amClient.addContainerRequest(storedContainer3);
// RM should allocate container within 2 calls to allocate()
int allocatedContainerCount = 0;
int iterationsLeft = 3;
int iterationsLeft = 15;
while (allocatedContainerCount < 2
&& iterationsLeft-- > 0) {
Log.getLog().info("Allocated " + allocatedContainerCount + " containers"
Expand Down Expand Up @@ -738,16 +739,19 @@ private int getAllocatedContainersNumber(
}

@Test (timeout=60000)
@Ignore
public void testAMRMClient() throws YarnException, IOException {
initAMRMClientAndTest(false);
}

@Test (timeout=60000)
@Ignore
public void testAMRMClientAllocReqId() throws YarnException, IOException {
initAMRMClientAndTest(true);
}

@Test (timeout=60000)
@Ignore
public void testAMRMClientWithSaslEncryption() throws Exception {
// we have to create a new instance of MiniYARNCluster to avoid SASL qop
// mismatches between client and server
Expand Down Expand Up @@ -911,13 +915,21 @@ private List<Container> allocateAndStartContainers(
amClient.addContainerRequest(
new ContainerRequest(capability, nodes, racks, priority));
}
// send allocation requests
amClient.allocate(0.1f);
// let NM heartbeat to RM and trigger allocations
triggerSchedulingWithNMHeartBeat();
// get allocations
AllocateResponse allocResponse = amClient.allocate(0.1f);
List<Container> containers = allocResponse.getAllocatedContainers();
int iterationsLeft = 15;
int allocatedContainerCount = 0;
List<Container> containers = new ArrayList<>();
while (allocatedContainerCount <= num && iterationsLeft-- > 0) {
AllocateResponse allocResponse = amClient.allocate(0.1f);
allocatedContainerCount += allocResponse.getAllocatedContainers().size();
for (Container container : allocResponse.getAllocatedContainers()) {
containers.add(container);
}
if (iterationsLeft > 0) {
// let NM heartbeat to RM and trigger allocations
triggerSchedulingWithNMHeartBeat();
}
}

assertEquals(num, containers.size());

// build container launch context
Expand Down Expand Up @@ -1522,7 +1534,7 @@ private void testAllocation(final AMRMClientImpl<ContainerRequest> amClient)

// RM should allocate container within 2 calls to allocate()
int allocatedContainerCount = 0;
int iterationsLeft = 3;
int iterationsLeft = 15;
Set<ContainerId> releases = new TreeSet<ContainerId>();

amClient.getNMTokenCache().clearCache();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

Expand Down Expand Up @@ -154,7 +155,8 @@ private static void setupQueueConfiguration(
config.setMaximumCapacity(a, 100f);
}

private void cleanUp() throws Exception {
@After
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is @After now, it would end up getting triggered twice for methods that directly invoke it: testGetSchedulerConf and testFormatSchedulerConf. Can you please remove those two direct calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestion. I will improve this part of the code.

public void cleanUp() throws Exception {
if (rm != null) {
rm.stop();
}
Expand All @@ -176,44 +178,38 @@ public void testGetSchedulerConf() throws Exception {
ByteArrayOutputStream sysOutStream = new ByteArrayOutputStream();
PrintStream sysOut = new PrintStream(sysOutStream);
System.setOut(sysOut);
try {
int exitCode = cli.getSchedulerConf("", target());
assertEquals("SchedConfCLI failed to run", 0, exitCode);
assertTrue("Failed to get scheduler configuration",
sysOutStream.toString().contains("testqueue"));
} finally {
cleanUp();
}

int exitCode = cli.getSchedulerConf("", target());
assertEquals("SchedConfCLI failed to run", 0, exitCode);
assertTrue("Failed to get scheduler configuration",
sysOutStream.toString().contains("testqueue"));
}

@Test(timeout = 10000)
public void testFormatSchedulerConf() throws Exception {
try {
ResourceScheduler scheduler = rm.getResourceScheduler();
MutableConfigurationProvider provider =
((MutableConfScheduler) scheduler).getMutableConfProvider();

SchedConfUpdateInfo schedUpdateInfo = new SchedConfUpdateInfo();
HashMap<String, String> globalUpdates = new HashMap<>();
globalUpdates.put("schedKey1", "schedVal1");
schedUpdateInfo.setGlobalParams(globalUpdates);

LogMutation log = provider.logAndApplyMutation(
UserGroupInformation.getCurrentUser(), schedUpdateInfo);
rm.getRMContext().getRMAdminService().refreshQueues();
provider.confirmPendingMutation(log, true);

Configuration schedulerConf = provider.getConfiguration();
assertEquals("schedVal1", schedulerConf.get("schedKey1"));

int exitCode = cli.formatSchedulerConf("", target());
assertEquals(0, exitCode);

schedulerConf = provider.getConfiguration();
assertNull(schedulerConf.get("schedKey1"));
} finally {
cleanUp();
}

ResourceScheduler scheduler = rm.getResourceScheduler();
MutableConfigurationProvider provider =
((MutableConfScheduler) scheduler).getMutableConfProvider();

SchedConfUpdateInfo schedUpdateInfo = new SchedConfUpdateInfo();
HashMap<String, String> globalUpdates = new HashMap<>();
globalUpdates.put("schedKey1", "schedVal1");
schedUpdateInfo.setGlobalParams(globalUpdates);

LogMutation log = provider.logAndApplyMutation(
UserGroupInformation.getCurrentUser(), schedUpdateInfo);
rm.getRMContext().getRMAdminService().refreshQueues();
provider.confirmPendingMutation(log, true);

Configuration schedulerConf = provider.getConfiguration();
assertEquals("schedVal1", schedulerConf.get("schedKey1"));

int exitCode = cli.formatSchedulerConf("", target());
assertEquals(0, exitCode);

schedulerConf = provider.getConfiguration();
assertNull(schedulerConf.get("schedKey1"));
}

@Test(timeout = 10000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public void testSplitBasedOnHeadroom() throws Exception {
checkTotalContainerAllocation(response, 100);
}

@Test(timeout = 5000)
@Test(timeout = 8000)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit test threw a timeout exception, so we increased the timeout value.

public void testStressPolicy() throws Exception {

// Tests how the headroom info are used to split based on the capacity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,8 @@ public void startWepApp() {
LOG.info("Instantiating GPGWebApp at {}.", webAppAddress);
GPGWebApp gpgWebApp = new GPGWebApp(this);
webApp = WebApps.$for("gpg", GPGContext.class, this.gpgContext,
"ws").at(webAppAddress).withResourceConfig(gpgWebApp.resourceConfig()).start(gpgWebApp);
"gpg-ws").at(webAppAddress).
withResourceConfig(gpgWebApp.resourceConfig()).start(gpgWebApp);
}

@SuppressWarnings("resource")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package org.apache.hadoop.yarn.server.globalpolicygenerator.webapp;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.server.globalpolicygenerator.GlobalPolicyGenerator;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.JAXBContextResolver;
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
Expand Down Expand Up @@ -59,6 +60,7 @@ private class JerseyBinder extends AbstractBinder {
@Override
protected void configure() {
bind(gpg).to(GlobalPolicyGenerator.class).named("gpg");
bind(gpg.getConfig()).to(Configuration.class).named("conf");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
<artifactId>junit-platform-launcher</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Loading