Package org.apache.whirr

Examples of org.apache.whirr.ClusterController


      return -1;
    }
   
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      ClusterController controller = createClusterController(clusterSpec.getServiceName());
      Cluster cluster = controller.launchCluster(clusterSpec);
      out.printf("Started cluster of %s instances\n",
          cluster.getInstances().size());
      out.println(cluster);
      return 0;
    } catch (IllegalArgumentException e) {
View Full Code Here


    try {
      if (!optionSet.hasArgument(instanceOption)) {
        throw new IllegalArgumentException("You need to specify an instance ID.");
      }
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      ClusterController controller = createClusterController(clusterSpec.getServiceName());

      String instanceId = optionSet.valueOf(instanceOption);
      controller.destroyInstance(clusterSpec, instanceId);

      return 0;

    } catch(IllegalArgumentException e) {
      err.println(e.getMessage());
View Full Code Here

      return -2;
    }

    try {
      ClusterSpec spec = getClusterSpec(optionSet);
      ClusterController controller = createClusterController(spec.getServiceName());

      Predicate<NodeMetadata> condition = buildFilterPredicate(optionSet, spec);

      return handleScriptOutput(out, err, controller.runScriptOnNodesMatching(
        spec, condition, execFile(optionSet.valueOf(scriptOption))));

    } catch(IllegalArgumentException e) {
      err.println(e.getMessage());
      printUsage(parser, err);
View Full Code Here

          .getProperty("config")));
    }
    config.addConfiguration(new PropertiesConfiguration(
        "whirr-chef-test.properties"));
    clusterSpec = ClusterSpec.withTemporaryKeys(config);
    controller = new ClusterController();
    controller.launchCluster(clusterSpec);
  }
View Full Code Here

      return -1;
    }
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      ClusterStateStore stateStore = createClusterStateStore(clusterSpec);
      ClusterController controller = createClusterController(clusterSpec.getServiceName());

      for (Cluster.Instance instance : controller.getInstances(clusterSpec, stateStore)) {
        out.println(Joiner.on('\t').useForNull("-").join(
            instance.getId(),
            instance.getNodeMetadata().getImageId(),
            instance.getPublicIp(),
            instance.getPrivateIp(),
View Full Code Here

      return -1;
    }
   
    try {
      ClusterSpec clusterSpec = getClusterSpec(optionSet);
      ClusterController controller = createClusterController(clusterSpec.getServiceName());
      Cluster cluster = controller.launchCluster(clusterSpec);
      out.printf("Started cluster of %s instances\n",
          cluster.getInstances().size());
      out.println(cluster);
     
      // print ssh command. do it for the first 20 instances so that the console
View Full Code Here

  /**
   * Create the specified service
   */
  protected ClusterController createClusterController(String serviceName) {
    ClusterController controller = factory.create(serviceName);
    if (controller == null) {
      LOG.warn("Unable to find service {}, using default.", serviceName);
      controller = factory.create(null);
    }
    return controller;
View Full Code Here

    config.setProperty("whirr.instance-templates",
        "10 noop+noop3,10 noop2+noop,10 noop3+noop2");
    config.setProperty("whirr.state-store", "memory");

    ClusterSpec clusterSpec = ClusterSpec.withTemporaryKeys(config);
    ClusterController controller = new ClusterController();

    controller.launchCluster(clusterSpec);
    controller.destroyCluster(clusterSpec);

    DryRun dryRun = DryRunModule.getDryRun();
    ListMultimap<NodeMetadata, RunScriptOnNode> perNodeExecutions = dryRun
        .getExecutions();
    List<RunScriptOnNode> totalExecutions = dryRun
View Full Code Here

    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);
  }
View Full Code Here

  }

  @Test
  public void testNoRemoteExecutionOverlap() throws Exception {
    ClusterSpec spec = getTestClusterSpec();
    ClusterController controller =
      (new ClusterControllerFactory()).create(spec.getServiceName());

    try {
      controller.launchCluster(spec);
      Map<? extends NodeMetadata, ExecResponse> responseMap = controller.runScriptOnNodesMatching(
        spec,
        Predicates.<NodeMetadata>alwaysTrue(),
        exec("cat /tmp/bootstrap-start /tmp/bootstrap-end /tmp/configure-start")
      );
      ExecResponse response = Iterables.get(responseMap.values(), 0);
      LOG.info("Got response: {}", response);

      String[] parts = Strings.split(response.getOutput(), '\n');

      int bootstrapStart = parseInt(deleteWhitespace(parts[0]));
      int bootstrapEnd = parseInt(deleteWhitespace(parts[1]));
      int configureStart = parseInt(deleteWhitespace(parts[2]));

      assertTrue(bootstrapStart < bootstrapEnd);
      assertTrue(bootstrapEnd < configureStart);

    } finally {
      controller.destroyCluster(spec);
    }

    assertNoOverlapOnLocalMachine();
  }
View Full Code Here

TOP

Related Classes of org.apache.whirr.ClusterController

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.