Package org.apache.whirr

Examples of org.apache.whirr.ClusterSpec


    statementBuilder = new StatementBuilder();
  }

  @Test
  public void testSetGlobalSpotPrice() throws Exception {
    ClusterSpec clusterSpec = buildClusterSpecWith(ImmutableMap.of(
      "whirr.instance-templates", "1 role1",
      "whirr.aws-ec2-spot-price", "0.3"
    ));
    assertSpotPriceIs(clusterSpec, "role1", 0.3f);
  }
View Full Code Here


    assertSpotPriceIs(clusterSpec, "role1", 0.3f);
  }

  @Test
  public void testOverrideSpotPrice() throws Exception {
    ClusterSpec clusterSpec = buildClusterSpecWith(ImmutableMap.of(
      "whirr.instance-templates", "1 role1",
      "whirr.aws-ec2-spot-price", "0.1",
      "whirr.templates.role1.aws-ec2-spot-price", "0.3"
    ));
    assertSpotPriceIs(clusterSpec, "role1", 0.3f);
View Full Code Here

    assertSpotPriceIs(clusterSpec, "role1", 0.3f);
  }

  @Test
  public void testDifferentPrices() throws Exception {
    ClusterSpec clusterSpec = buildClusterSpecWith(ImmutableMap.of(
      "whirr.instance-templates", "1 role1, 1 role2",
      "whirr.aws-ec2-spot-price", "0.1",
      "whirr.templates.role2.aws-ec2-spot-price", "0.3"
    ));
    assertSpotPriceIs(clusterSpec, "role1", 0.1f);
View Full Code Here

public class DestroyCluster extends WhirrCommandSupport {

  @Override
  protected Object doExecute() throws Exception {
    DestroyClusterCommand command = new DestroyClusterCommand(clusterControllerFactory);
    ClusterSpec clusterSpec = getClusterSpec();
    if (clusterSpec != null) {
      command.run(System.in, System.out, System.err, clusterSpec);
    }
    return null;
  }
View Full Code Here

public class ListCluster extends WhirrCommandSupport {

  @Override
  protected Object doExecute() throws Exception {
    ListClusterCommand command = new ListClusterCommand(clusterControllerFactory);
    ClusterSpec clusterSpec = getClusterSpec();
    if (clusterSpec != null) {
      command.run(System.in, System.out, System.err, clusterSpec);
    }
    return null;
  }
View Full Code Here

  protected String script;

  @Override
  protected Object doExecute() throws Exception {
    RunScriptCommand command = new RunScriptCommand(clusterControllerFactory);
    ClusterSpec clusterSpec = getClusterSpec();
    if (clusterSpec != null) {
      command.run(System.in, System.out, System.err, clusterSpec,
        instances.toArray(new String[instances.size()]), roles.toArray(new String[roles.size()]), script);
    }
    return null;
View Full Code Here

  protected String instance;

  @Override
  protected Object doExecute() throws Exception {
    DestroyInstanceCommand command = new DestroyInstanceCommand(clusterControllerFactory);
    ClusterSpec clusterSpec = getClusterSpec();
    if (clusterSpec != null) {
      command.run(System.in, System.out, System.err, clusterSpec, instance);
    }
    return null;
  }
View Full Code Here

   *
   * @return
   * @throws Exception
   */
  protected ClusterSpec getClusterSpec() throws Exception {
    ClusterSpec clusterSpec = null;
    PropertiesConfiguration properties = getConfiguration(pid, fileName);
    if (properties != null) {
      clusterSpec = new ClusterSpec(properties);
      if (privateKey != null) {
        clusterSpec.setPrivateKey(privateKey);
      }
      if (clusterName != null) {
        clusterSpec.setClusterName(clusterName);
      }
    }
    return clusterSpec;
  }
View Full Code Here

    return ROLE;
  }

  @Override
  protected void beforeBootstrap(ClusterActionEvent event) throws IOException {
    ClusterSpec spec = event.getClusterSpec();
    Configuration config = spec.getConfiguration();

    addStatement(event, call("retry_helpers"));
    addStatement(event, call("install_tarball"));

    addStatement(event, call(getInstallFunction(config, "java", "install_openjdk")));
View Full Code Here

    addStatement(event, call("install_elasticsearch", tarurl));
  }

  @Override
  protected void beforeConfigure(ClusterActionEvent event) throws IOException {
    ClusterSpec spec = event.getClusterSpec();
    Cluster cluster = event.getCluster();

    event.getFirewallManager().addRule(
      Rule.create()
        .destination(cluster.getInstancesMatching(role(ROLE)))
View Full Code Here

TOP

Related Classes of org.apache.whirr.ClusterSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.