class NovaLauncher extends Launcher {

  public boolean cleanupFailedNodes(Map<NodeMetadata, Throwable> failedNodes) {
    boolean success;
    if (failedNodes.size() > 0) {
      Set<String> lostIds = Sets.newLinkedHashSet();
      for (Map.Entry<NodeMetadata, Throwable> lostNode : failedNodes.entrySet()) {
        lostIds.add(lostNode.getKey().getId());
      }
      int numberOfNodesToDelete = lostIds.size();
      logger.info(String.format("Destroying failed nodes with ids: %s", lostIds.toString()));
      Set<? extends NodeMetadata> destroyedNodes = novaContext.getComputeService().destroyNodesMatching(
              Predicates.in(failedNodes.keySet()));
      lostIds.clear();
      for (NodeMetadata destroyed : destroyedNodes) {
        lostIds.add(destroyed.getId());
      }
      logger.info("Failed nodes destroyed ;)");
      int numberOfNodesSuccesfullyDeleted = lostIds.size();
      success = numberOfNodesSuccesfullyDeleted == numberOfNodesToDelete;
    } else {
      success = true;
    }
    return success;

  }

  public  NovaLauncher(NovaContext novaContext, SshKeyPair sshKeyPair);

}