Exemplo n.º 1
0
  /**
   * Update an action into database table
   *
   * @param coordJob coordinator job bean
   * @param coordAction coordinator action bean
   * @throws Exception thrown failed to update coordinator action bean or unable to write sla
   *     registration event
   */
  private void updateAction(CoordinatorJobBean coordJob, CoordinatorActionBean coordAction)
      throws Exception {
    LOG.debug("updateAction for actionId=" + coordAction.getId());
    if (coordAction.getStatus() == CoordinatorAction.Status.TIMEDOUT) {
      LOG.debug("Updating created time for TIMEDOUT action id =" + coordAction.getId());
      coordAction.setCreatedTime(new Date());
    }
    coordAction.setStatus(CoordinatorAction.Status.WAITING);
    if (!failed) {
      coordAction.setExternalId(null);
    }
    coordAction.setExternalStatus(null);
    coordAction.setRerunTime(new Date());
    coordAction.setLastModifiedTime(new Date());
    coordAction.setErrorCode("");
    coordAction.setErrorMessage("");

    // Pushing the configuration which passed through rerun.
    if (actionRunConf != null && actionRunConf.size() > 0) {
      Configuration createdConf = null;
      if (coordAction.getCreatedConf() != null) {
        createdConf = new XConfiguration(new StringReader(coordAction.getCreatedConf()));
      } else {
        createdConf = new Configuration();
      }
      createdConf.set(RERUN_CONF, XmlUtils.prettyPrint(actionRunConf).toString());
      coordAction.setCreatedConf(XmlUtils.prettyPrint(createdConf).toString());
    }
    updateList.add(
        new UpdateEntry<CoordActionQuery>(CoordActionQuery.UPDATE_COORD_ACTION_RERUN, coordAction));
    writeActionRegistration(
        coordAction.getActionXml(), coordAction, coordJob.getUser(), coordJob.getGroup());
  }
Exemplo n.º 2
0
 @Override
 protected void setUp() throws Exception {
   baseConf = new Configuration();
   baseConf.set("A", "1");
   baseConf.setInt("B", 2);
   baseConf.set("C", "3");
   baseConfSize = baseConf.size();
 }
Exemplo n.º 3
0
  public MiniAccumuloClusterImpl create(
      String testClassName,
      String testMethodName,
      AuthenticationToken token,
      MiniClusterConfigurationCallback configCallback,
      TestingKdc kdc)
      throws Exception {
    requireNonNull(token);
    checkArgument(
        token instanceof PasswordToken || token instanceof KerberosToken,
        "A PasswordToken or KerberosToken is required");

    String rootPasswd;
    if (token instanceof PasswordToken) {
      rootPasswd = new String(((PasswordToken) token).getPassword(), UTF_8);
    } else {
      rootPasswd = UUID.randomUUID().toString();
    }

    File baseDir = AccumuloClusterHarness.createTestDir(testClassName + "_" + testMethodName);
    MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(baseDir, rootPasswd);

    // Enable native maps by default
    cfg.setNativeLibPaths(NativeMapIT.nativeMapLocation().getAbsolutePath());
    cfg.setProperty(Property.TSERV_NATIVEMAP_ENABLED, Boolean.TRUE.toString());

    Configuration coreSite = new Configuration(false);

    // Setup SSL and credential providers if the properties request such
    configureForEnvironment(
        cfg, getClass(), AccumuloClusterHarness.getSslDir(baseDir), coreSite, kdc);

    // Invoke the callback for tests to configure MAC before it starts
    configCallback.configureMiniCluster(cfg, coreSite);

    MiniAccumuloClusterImpl miniCluster = new MiniAccumuloClusterImpl(cfg);

    // Write out any configuration items to a file so HDFS will pick them up automatically (from the
    // classpath)
    if (coreSite.size() > 0) {
      File csFile = new File(miniCluster.getConfig().getConfDir(), "core-site.xml");
      if (csFile.exists()) throw new RuntimeException(csFile + " already exist");

      OutputStream out =
          new BufferedOutputStream(
              new FileOutputStream(
                  new File(miniCluster.getConfig().getConfDir(), "core-site.xml")));
      coreSite.writeXml(out);
      out.close();
    }

    return miniCluster;
  }
  @CliCommand(
      value = {PREFIX + "load"},
      help = "Loads the Hadoop configuration from the given resource")
  public String loadConfiguration(
      @CliOption(
              key = {"", "location"},
              mandatory = true,
              help = "configuration location (can be a URL)")
          String location) {
    hadoopConfiguration.addResource(location);
    hadoopConfiguration.size();

    return listProps();
  }