Search in sources :

Example 21 with ClusterController

use of org.apache.whirr.ClusterController in project whirr by apache.

the class VoldemortServiceTest method setUp.

@Before
public void setUp() throws Exception {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
        config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-voldemort-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);
    waitForBootstrap();
}
Also used : ClusterController(org.apache.whirr.ClusterController) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) Before(org.junit.Before)

Example 22 with ClusterController

use of org.apache.whirr.ClusterController in project whirr by apache.

the class MahoutServiceTest method setUp.

@BeforeClass
public static void setUp() throws Exception {
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
        config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration("whirr-mahout-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    controller.launchCluster(clusterSpec);
}
Also used : ClusterController(org.apache.whirr.ClusterController) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration) BeforeClass(org.junit.BeforeClass)

Example 23 with ClusterController

use of org.apache.whirr.ClusterController in project whirr by apache.

the class HBaseServiceController method startup.

public synchronized void startup() throws Exception {
    LOG.info("Starting up cluster...");
    CompositeConfiguration config = new CompositeConfiguration();
    if (System.getProperty("config") != null) {
        config.addConfiguration(new PropertiesConfiguration(System.getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration(this.configResource));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    cluster = controller.launchCluster(clusterSpec);
    proxy = new HadoopProxy(clusterSpec, cluster);
    proxy.start();
    waitForMaster();
    running = true;
}
Also used : ClusterController(org.apache.whirr.ClusterController) CompositeConfiguration(org.apache.commons.configuration.CompositeConfiguration) HadoopProxy(org.apache.whirr.service.hadoop.HadoopProxy) PropertiesConfiguration(org.apache.commons.configuration.PropertiesConfiguration)

Example 24 with ClusterController

use of org.apache.whirr.ClusterController in project whirr by apache.

the class RunScriptCommand method run.

public int run(InputStream in, PrintStream out, PrintStream err, ClusterSpec clusterSpec, String[] instances, String[] roles, String fileName) throws Exception {
    ClusterController controller = createClusterController(clusterSpec.getServiceName());
    Predicate<NodeMetadata> condition = buildFilterPredicate(instances, roles, clusterSpec);
    return handleScriptOutput(out, err, controller.runScriptOnNodesMatching(clusterSpec, condition, execFile(fileName)));
}
Also used : NodeMetadata(org.jclouds.compute.domain.NodeMetadata) ClusterController(org.apache.whirr.ClusterController)

Example 25 with ClusterController

use of org.apache.whirr.ClusterController in project whirr by apache.

the class DestroyInstanceCommandTest method testDestroyInstanceById.

@Test
public void testDestroyInstanceById() throws Exception {
    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String) any())).thenReturn(controller);
    DestroyInstanceCommand command = new DestroyInstanceCommand(factory);
    Map<String, File> keys = KeyPair.generateTemporaryFiles();
    int rc = command.run(null, out, null, Lists.newArrayList("--instance-templates", "1 noop", "--instance-id", "region/instanceid", "--service-name", "test-service", "--cluster-name", "test-cluster", "--provider", "rackspace", "--identity", "myusername", "--credential", "mypassword", "--private-key-file", keys.get("private").getAbsolutePath(), "--version", "version-string"));
    assertThat(rc, is(0));
    verify(controller).destroyInstance((ClusterSpec) any(), eq("region/instanceid"));
}
Also used : ClusterController(org.apache.whirr.ClusterController) Matchers.containsString(org.hamcrest.Matchers.containsString) ClusterControllerFactory(org.apache.whirr.ClusterControllerFactory) File(java.io.File) Test(org.junit.Test)

Aggregations

ClusterController (org.apache.whirr.ClusterController)42 PropertiesConfiguration (org.apache.commons.configuration.PropertiesConfiguration)23 CompositeConfiguration (org.apache.commons.configuration.CompositeConfiguration)22 Test (org.junit.Test)12 ClusterSpec (org.apache.whirr.ClusterSpec)10 ClusterControllerFactory (org.apache.whirr.ClusterControllerFactory)9 HadoopProxy (org.apache.whirr.service.hadoop.HadoopProxy)9 Before (org.junit.Before)8 File (java.io.File)7 Matchers.containsString (org.hamcrest.Matchers.containsString)7 NodeMetadata (org.jclouds.compute.domain.NodeMetadata)7 BeforeClass (org.junit.BeforeClass)7 Cluster (org.apache.whirr.Cluster)6 DryRun (org.apache.whirr.service.DryRunModule.DryRun)5 Collection (java.util.Collection)3 Configuration (org.apache.commons.configuration.Configuration)3 Configuration (org.apache.hadoop.conf.Configuration)3 JobClient (org.apache.hadoop.mapred.JobClient)3 JobConf (org.apache.hadoop.mapred.JobConf)3 ClusterStateStore (org.apache.whirr.state.ClusterStateStore)3