You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 04:49:07 UTC
svn commit: r1077179 - in
/hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process:
ClusterProcessManager.java HadoopDaemonRemoteCluster.java
Author: omalley
Date: Fri Mar 4 03:49:06 2011
New Revision: 1077179
URL: http://svn.apache.org/viewvc?rev=1077179&view=rev
Log:
commit 80f87df12b0591e2969406c3a582612f4f7106b1
Author: Konstantin Boudnik <co...@goodenter-lm.local>
Date: Mon Feb 22 19:18:13 2010 -0800
from
Modified:
hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/ClusterProcessManager.java
hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/HadoopDaemonRemoteCluster.java
Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/ClusterProcessManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/ClusterProcessManager.java?rev=1077179&r1=1077178&r2=1077179&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/ClusterProcessManager.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/ClusterProcessManager.java Fri Mar 4 03:49:06 2011
@@ -68,4 +68,17 @@ public interface ClusterProcessManager {
*/
void stop() throws IOException;
+ /**
+ * Method cleans the remote hosts' directories used by a deployed cluster
+ * @throws IOException is thrown if cleaning process fails or terminates with
+ * non-zero exit code
+ */
+ void cleanDirs() throws Exception;
+
+ /**
+ * Method (re)reploys cluster bits to the remote hosts
+ * @throws IOException is thrown if cleaning process fails or terminates with
+ * non-zero exit code
+ */
+ void deploy() throws IOException;
}
Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/HadoopDaemonRemoteCluster.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/HadoopDaemonRemoteCluster.java?rev=1077179&r1=1077178&r2=1077179&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/HadoopDaemonRemoteCluster.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/system/java/org/apache/hadoop/test/system/process/HadoopDaemonRemoteCluster.java Fri Mar 4 03:49:06 2011
@@ -53,6 +53,13 @@ public class HadoopDaemonRemoteCluster i
public final static String CONF_DEPLOYED_HADOOPCONFDIR =
"test.system.hdrc.deployed.hadoopconfdir";
+ /**
+ * Key is used to configure the location of deployment control directory
+ * where additional helper scripts might reside
+ */
+ public final static String CONF_STAGED_HADOOP_CONTROLDIR =
+ "test.system.hdrc.staged.controldir";
+
private String hadoopHome;
private String hadoopConfDir;
private String deployed_hadoopConfDir;
@@ -176,6 +183,32 @@ public class HadoopDaemonRemoteCluster i
}
}
+ @Override
+ public void cleanDirs() throws Exception {
+ File controlDir = getControlDirectory();
+ if (controlDir == null) {
+ LOG.warn("External tools for cluster control aren't available");
+ return;
+ }
+ String [] cmd = new String[]{"clusterCleanupFs.sh"};
+ ShellCommandExecutor cleanScript =
+ new ShellCommandExecutor(cmd, controlDir);
+ cleanScript.execute();
+ }
+
+ @Override
+ public void deploy() throws IOException {
+ File controlDir = getControlDirectory();
+ if (controlDir == null) {
+ LOG.warn("External tools for cluster control aren't available");
+ return;
+ }
+ String [] cmd = new String[]{"clusterInstall.sh"};
+ ShellCommandExecutor installScript =
+ new ShellCommandExecutor(cmd, controlDir);
+ installScript.execute();
+ }
+
private void populateDaemons(String confLocation) throws IOException {
File mastersFile = new File(confLocation, MASTERS_FILE);
File slavesFile = new File(confLocation, SLAVES_FILE);
@@ -220,6 +253,16 @@ public class HadoopDaemonRemoteCluster i
}
}
+ private static File getControlDirectory () {
+ String controlDirLocation = System.getProperty(CONF_STAGED_HADOOP_CONTROLDIR);
+ if (controlDirLocation != null) {
+ File controlDir = new File(controlDirLocation);
+ if (!controlDir.exists())
+ return controlDir;
+ }
+ return null;
+ }
+
/**
* The core daemon class which actually implements the remote process
* management of actual daemon processes in the cluster.