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 @@ -9,12 +9,15 @@
import com.google.common.collect.Sets;
import com.linkedin.dynamometer.workloadgenerator.audit.AuditLogDirectParser;
import com.linkedin.dynamometer.workloadgenerator.audit.AuditReplayMapper;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -152,8 +155,6 @@ public static void setupClass() throws Exception {
fail("Unable to execute tar to expand Hadoop binary");
}

conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_FIXED_PORTS, true);
conf.setBoolean(YarnConfiguration.YARN_MINICLUSTER_USE_RPC, true);
conf.setInt(YarnConfiguration.RM_SCHEDULER_MINIMUM_ALLOCATION_MB, 128);
conf.setBoolean(YarnConfiguration.NODE_LABELS_ENABLED, true);
for (String q : new String[] { "root", "root.default" } ) {
Expand Down Expand Up @@ -182,6 +183,21 @@ public static void setupClass() throws Exception {
FileSystem.setDefaultUri(yarnConf, miniDFSCluster.getURI());
fs = miniDFSCluster.getFileSystem();

URL url = Thread.currentThread().getContextClassLoader().getResource("yarn-site.xml");
if (url == null) {
throw new RuntimeException("Could not find 'yarn-site.xml' dummy file in classpath");
}
yarnConf.set(YarnConfiguration.YARN_APPLICATION_CLASSPATH, new File(url.getPath()).getParent());
// Write the XML to a buffer before writing to the file. writeXml() can trigger a read of the existing
// yarn-site.xml, so writing directly could trigger a read of the file while it is in an inconsistent state
// (partially written)
try (ByteArrayOutputStream bytesOut = new ByteArrayOutputStream()) {
yarnConf.writeXml(bytesOut);
try (OutputStream fileOut = new FileOutputStream(new File(url.getPath()))) {
fileOut.write(bytesOut.toByteArray());
}
}

yarnClient = YarnClient.createYarnClient();
yarnClient.init(new Configuration(yarnConf));
yarnClient.start();
Expand Down
12 changes: 12 additions & 0 deletions dynamometer-infra/src/test/resources/yarn-site.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--

Copyright 2019 LinkedIn Corporation. All rights reserved. Licensed under the BSD-2 Clause license.
See LICENSE in the project root for license information.

-->

<configuration>
<!-- Dummy (invalid) config file to be overwritten by tests with MiniCluster configuration. -->
</configuration>