Пример #1
0
  @Override
  protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    this.clusters.clear();

    Configuration conf = context.getConfiguration();
    parse.setup(conf);

    try {

      String clusterPath = conf.get(KMeansDriver.CLUSTER_PATH_KEY);
      if (clusterPath != null && clusterPath.length() > 0) {
        KmeansPublic.configureWithClusterInfo(conf, new Path(clusterPath), clusters);
        if (clusters.isEmpty()) {
          throw new IllegalStateException("No clusters found. Check your -c path.");
        }
      }
    } catch (Throwable e) {
      throw new IllegalStateException(e);
    }
  }