Skip to content

Commit

Permalink
Fixed port conflicts between unit tests and running nephele instantces.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephanEwen committed May 26, 2013
1 parent fff0171 commit 71d6f25
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
/**
* This class contains all constants for the configuration. That includes the configuration keys and
* the default values.
*
* @author Stephan Ewen ([email protected])
*/
public final class ConfigConstants {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class DiscoveryService implements Runnable {
* The key to retrieve the network port the discovery service listens on for incoming connections from the
* configuration.
*/
private static final String DISCOVERYPORT_KEY = "discoveryservice.port";
public static final String DISCOVERYPORT_KEY = "discoveryservice.port";

/**
* The default network port the discovery service listens on for incoming connections.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import eu.stratosphere.nephele.configuration.ConfigConstants;
import eu.stratosphere.nephele.configuration.Configuration;
import eu.stratosphere.nephele.configuration.GlobalConfiguration;
import eu.stratosphere.nephele.discovery.DiscoveryService;
import eu.stratosphere.nephele.instance.InstanceType;
import eu.stratosphere.nephele.instance.InstanceTypeDescription;
import eu.stratosphere.nephele.jobgraph.JobGraph;
Expand All @@ -36,6 +37,8 @@ public class NepheleMiniCluster {

private static final int DEFAULT_TM_DATA_PORT = 7501;

private static final int DEFAULT_DISCOVERY_PORT = 7533;

private static final boolean DEFAULT_VISUALIZER_ENABLED = true;

// --------------------------------------------------------------------------------------------
Expand All @@ -48,6 +51,8 @@ public class NepheleMiniCluster {

private int taskManagerDataPort = DEFAULT_TM_DATA_PORT;

private int discoveryPort = DEFAULT_DISCOVERY_PORT;

private String configDir;

private String hdfsConfigFile;
Expand Down Expand Up @@ -86,6 +91,14 @@ public int getTaskManagerDataPort() {
public void setTaskManagerDataPort(int taskManagerDataPort) {
this.taskManagerDataPort = taskManagerDataPort;
}

public int getDiscoveryPort() {
return discoveryPort;
}

public void setDiscoveryPort(int discoveryPort) {
this.discoveryPort = discoveryPort;
}

public String getConfigDir() {
return configDir;
Expand Down Expand Up @@ -130,7 +143,7 @@ public void start() throws Exception {
GlobalConfiguration.loadConfiguration(configDir);
} else {
Configuration conf = getMiniclusterDefaultConfig(jobManagerRpcPort, taskManagerRpcPort,
taskManagerDataPort, hdfsConfigFile, visualizerEnabled);
taskManagerDataPort, discoveryPort, hdfsConfigFile, visualizerEnabled);
GlobalConfiguration.includeConfiguration(conf);
}

Expand Down Expand Up @@ -190,7 +203,7 @@ private void waitForJobManagerToBecomeReady() throws InterruptedException {
}

private static Configuration getMiniclusterDefaultConfig(int jobManagerRpcPort, int taskManagerRpcPort,
int taskManagerDataPort, String hdfsConfigFile, boolean visualization)
int taskManagerDataPort, int discoveryPort, String hdfsConfigFile, boolean visualization)
{
final Configuration config = new Configuration();

Expand All @@ -199,6 +212,7 @@ private static Configuration getMiniclusterDefaultConfig(int jobManagerRpcPort,
config.setInteger(ConfigConstants.JOB_MANAGER_IPC_PORT_KEY, jobManagerRpcPort);
config.setInteger(ConfigConstants.TASK_MANAGER_IPC_PORT_KEY, taskManagerRpcPort);
config.setInteger(ConfigConstants.TASK_MANAGER_DATA_PORT_KEY, taskManagerDataPort);
config.setInteger(DiscoveryService.DISCOVERYPORT_KEY, discoveryPort);

// polling interval
config.setInteger(ConfigConstants.JOBCLIENT_POLLING_INTERVAL_KEY, 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.fs.FileSystem;
import org.apache.log4j.BasicConfigurator;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand All @@ -52,11 +51,6 @@

public abstract class TestBase {

/* Make sure there is a valid log4j appender */
static {
BasicConfigurator.configure();
}

private static final int MINIMUM_HEAP_SIZE_MB = 192;

private static final Log LOG = LogFactory.getLog(TestBase.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.util.List;

import org.apache.hadoop.fs.FileSystem;
import org.apache.log4j.BasicConfigurator;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
Expand All @@ -48,11 +47,6 @@

public abstract class TestBase2 {

/* Make sure there is a valid log4j appender */
static {
BasicConfigurator.configure();
}

private static final int MINIMUM_HEAP_SIZE_MB = 192;

protected final Configuration config;
Expand Down

0 comments on commit 71d6f25

Please sign in to comment.