Author: asavu
Date: Thu Jan 5 18:29:44 2012
New Revision: 1227732
URL: http://svn.apache.org/viewvc?rev=1227732&view=rev
Log:
WHIRR-421. Fetch NodeMetadata using API calls
Modified:
whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java
whirr/trunk/services/hadoop/pom.xml
whirr/trunk/services/hadoop/src/main/resources/whirr-hadoop-default.properties
whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test-single.properties
whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test.properties
Modified: whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java
URL:
http://svn.apache.org/viewvc/whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java?rev=1227732&r1=1227731&r2=1227732&view=diff
==============================================================================
--- whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java
(original)
+++ whirr/trunk/core/src/main/java/org/apache/whirr/ClusterController.java Thu
Jan 5 18:29:44 2012
@@ -107,10 +107,8 @@ public class ClusterController {
throws IOException, InterruptedException {
try {
Cluster cluster = bootstrapCluster(clusterSpec);
- configureServices(clusterSpec);
- startServices(clusterSpec);
-
- return cluster;
+ cluster = configureServices(clusterSpec, cluster);
+ return startServices(clusterSpec, cluster);
} catch (Throwable e) {
@@ -140,45 +138,53 @@ public class ClusterController {
/**
* Configure cluster services
*/
- public void configureServices(ClusterSpec clusterSpec) throws IOException,
InterruptedException {
- ClusterStateStore stateStore = getClusterStateStore(clusterSpec);
- Cluster cluster = stateStore.load();
+ public Cluster configureServices(ClusterSpec spec) throws IOException,
InterruptedException {
+ return configureServices(spec, new Cluster(getInstances(spec,
getClusterStateStore(spec))));
+ }
+ public Cluster configureServices(ClusterSpec clusterSpec, Cluster cluster)
+ throws IOException, InterruptedException {
ConfigureClusterAction configurer = new
ConfigureClusterAction(getCompute(), HANDLERS);
- configurer.execute(clusterSpec, cluster);
+ return configurer.execute(clusterSpec, cluster);
}
/**
* Start the cluster services
*/
- public void startServices(ClusterSpec clusterSpec) throws IOException,
InterruptedException {
- ClusterStateStore stateStore = getClusterStateStore(clusterSpec);
- Cluster cluster = stateStore.load();
+ public Cluster startServices(ClusterSpec spec) throws IOException,
InterruptedException {
+ return startServices(spec, new Cluster(getInstances(spec,
getClusterStateStore(spec))));
+ }
+ public Cluster startServices(ClusterSpec clusterSpec, Cluster cluster)
+ throws IOException, InterruptedException {
StartClusterAction starter = new StartClusterAction(getCompute(),
HANDLERS);
- starter.execute(clusterSpec, cluster);
+ return starter.execute(clusterSpec, cluster);
}
/**
* Stop the cluster services
*/
- public void stopServices(ClusterSpec clusterSpec) throws IOException,
InterruptedException {
- ClusterStateStore stateStore = getClusterStateStore(clusterSpec);
- Cluster cluster = stateStore.load();
+ public Cluster stopServices(ClusterSpec spec) throws IOException,
InterruptedException {
+ return stopServices(spec, new Cluster(getInstances(spec,
getClusterStateStore(spec))));
+ }
+ public Cluster stopServices(ClusterSpec clusterSpec, Cluster cluster)
+ throws IOException, InterruptedException {
StopClusterAction stopper = new StopClusterAction(getCompute(), HANDLERS);
- stopper.execute(clusterSpec, cluster);
+ return stopper.execute(clusterSpec, cluster);
}
/**
* Remove the cluster services
*/
- public void cleanupCluster(ClusterSpec clusterSpec) throws IOException,
InterruptedException {
- ClusterStateStore stateStore = getClusterStateStore(clusterSpec);
- Cluster cluster = stateStore.load();
+ public Cluster cleanupCluster(ClusterSpec spec) throws IOException,
InterruptedException {
+ return cleanupCluster(spec, new Cluster(getInstances(spec,
getClusterStateStore(spec))));
+ }
+ public Cluster cleanupCluster(ClusterSpec clusterSpec, Cluster cluster)
+ throws IOException, InterruptedException {
CleanupClusterAction cleanner = new CleanupClusterAction(getCompute(),
HANDLERS);
- cleanner.execute(clusterSpec, cluster);
+ return cleanner.execute(clusterSpec, cluster);
}
/**
@@ -188,17 +194,17 @@ public class ClusterController {
* or may not have been stopped.
* @throws InterruptedException if the thread is interrupted.
*/
- public void destroyCluster(ClusterSpec clusterSpec) throws IOException,
- InterruptedException {
-
+ public void destroyCluster(ClusterSpec clusterSpec)
+ throws IOException, InterruptedException {
ClusterStateStore stateStore = getClusterStateStore(clusterSpec);
- Cluster cluster = stateStore.tryLoadOrEmpty();
+ destroyCluster(clusterSpec, stateStore.tryLoadOrEmpty());
+ stateStore.destroy();
+ }
- DestroyClusterAction destroyer = new DestroyClusterAction(getCompute(),
- HandlerMapFactory.create());
+ public void destroyCluster(ClusterSpec clusterSpec, Cluster cluster)
+ throws IOException, InterruptedException {
+ DestroyClusterAction destroyer = new DestroyClusterAction(getCompute(),
HANDLERS);
destroyer.execute(clusterSpec, cluster);
-
- stateStore.destroy();
}
public void destroyInstance(ClusterSpec clusterSpec, String instanceId)
throws IOException {
Modified: whirr/trunk/services/hadoop/pom.xml
URL:
http://svn.apache.org/viewvc/whirr/trunk/services/hadoop/pom.xml?rev=1227732&r1=1227731&r2=1227732&view=diff
==============================================================================
--- whirr/trunk/services/hadoop/pom.xml (original)
+++ whirr/trunk/services/hadoop/pom.xml Thu Jan 5 18:29:44 2012
@@ -100,6 +100,12 @@
<version>${hadoop.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.3</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
Modified:
whirr/trunk/services/hadoop/src/main/resources/whirr-hadoop-default.properties
URL:
http://svn.apache.org/viewvc/whirr/trunk/services/hadoop/src/main/resources/whirr-hadoop-default.properties?rev=1227732&r1=1227731&r2=1227732&view=diff
==============================================================================
---
whirr/trunk/services/hadoop/src/main/resources/whirr-hadoop-default.properties
(original)
+++
whirr/trunk/services/hadoop/src/main/resources/whirr-hadoop-default.properties
Thu Jan 5 18:29:44 2012
@@ -16,7 +16,7 @@
# limitations under the License.
#
-whirr.hadoop.version=0.20.2
+whirr.hadoop.version=0.20.205.0
whirr.hadoop.tarball.url=http://archive.apache.org/dist/hadoop/core/hadoop-${whirr.hadoop.version}/hadoop-${whirr.hadoop.version}.tar.gz
# Hadoop defaults. The first part of the key is removed by whirr.
Modified:
whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test-single.properties
URL:
http://svn.apache.org/viewvc/whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test-single.properties?rev=1227732&r1=1227731&r2=1227732&view=diff
==============================================================================
---
whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test-single.properties
(original)
+++
whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test-single.properties
Thu Jan 5 18:29:44 2012
@@ -16,7 +16,7 @@
# limitations under the License.
#
whirr.cluster-name=hadoop-single-itest-${sys:whirr.test.provider}-${sys:user.name}
-whirr.instance-templates=1
hadoop-jobtracker+hadoop-namenode+hadoop-datanode+hadoop-tasktracker
+whirr.instance-templates=1
hadoop-namenode+hadoop-jobtracker+hadoop-datanode+hadoop-tasktracker
whirr.provider=${sys:whirr.test.provider}
whirr.identity=${sys:whirr.test.identity}
Modified:
whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test.properties
URL:
http://svn.apache.org/viewvc/whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test.properties?rev=1227732&r1=1227731&r2=1227732&view=diff
==============================================================================
--- whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test.properties
(original)
+++ whirr/trunk/services/hadoop/src/test/resources/whirr-hadoop-test.properties
Thu Jan 5 18:29:44 2012
@@ -16,7 +16,7 @@
# limitations under the License.
#
whirr.cluster-name=hadoop-itest-${sys:whirr.test.provider}-${sys:user.name}
-whirr.instance-templates=1 hadoop-jobtracker+hadoop-namenode,1
hadoop-datanode+hadoop-tasktracker
+whirr.instance-templates=1 hadoop-namenode+hadoop-jobtracker,1
hadoop-datanode+hadoop-tasktracker
whirr.provider=${sys:whirr.test.provider}
whirr.identity=${sys:whirr.test.identity}