예제 #1
0
 public void buildRowkey(Integer thisItemId) {
   String explorationNumber =
       Text.zeroPad(new Long(this.schedule.pipelineStage.pipeline.getPipelineNumber()), 5);
   String stageNumber = Text.zeroPad(new Long(this.schedule.pipelineStage.getStageNumber()), 5);
   String scheduleItemNumber = Text.zeroPad(new Long(thisItemId), 5);
   this.rowkey = explorationNumber + "." + stageNumber + "." + scheduleItemNumber;
 }
예제 #2
0
  /**
   * builds an ScheduleItem object from a Result object obtained from a Scan or Get in the
   * underlying storage
   *
   * @param result
   * @return
   */
  public static ScheduleItem fromResultObject(Schedule schedule, Result result) {
    ScheduleItem r = ScheduleItem.fromRowKey(schedule, result.getRowKey());

    byte[] stat = result.getValue("bigs", "status");
    if (stat != null) {
      r.setStatusFromString(new String(stat));
    }

    byte[] etime = result.getValue("bigs", "elapsedtime");
    if (etime != null) {
      r.setElapsedTime(new Long(new String(etime)));
    }

    byte[] lastupdate = result.getValue("bigs", "lastupdate");
    if (lastupdate != null) {
      r.setLastUpdateFromString(new String(lastupdate));
    }

    byte[] suuid = result.getValue("bigs", "uuid");
    if (suuid != null) {
      r.setUuidStored(new String(suuid));
    }

    byte[] smethod = result.getValue("scheduling", "method");
    if (smethod != null) {
      r.setMethodName(new String(smethod));
    }

    byte[] shostname = result.getValue("bigs", "hostname");
    if (shostname != null) {
      r.setHostnameStored(new String(shostname));
    }

    String parentsIdsString = new String(result.getValue("scheduling", "parents"));

    if (parentsIdsString != null && !parentsIdsString.trim().isEmpty()) {
      r.parentsRowkeys = Text.parseObjectList(parentsIdsString, " ", String.class);
    }

    r.preparedTask = TaskHelper.fromResultObject(result, "scheduling", "task.class", "task.object");
    r.processState = State.fromResultObject(result, "content", "class", "data");
    r.preparedTaskContainer =
        TaskContainer.fromResultObject(
            result, "scheduling", "task.container.class", "task.container.object");
    if (schedule != null) {
      r.preparedTaskContainer.setPipelineStage(schedule.getPipelineStage());
    }
    r.tags = result.getFamilyMap("tags");

    return r;
  }
예제 #3
0
  /**
   * Fills a Put object leaving it ready to persist this schedule item into the underlying storage
   *
   * @param put the Put object to fill in
   * @return the same object filled in
   */
  public Put fillPutObject(Put put) {

    if (this.preparedTask != null) {
      TaskHelper.toPutObject(this.preparedTask, put, "scheduling", "task.class", "task.object");
    }

    if (this.preparedTaskContainer != null) {
      this.preparedTaskContainer.toPutObject(
          put, "scheduling", "task.container.class", "task.container.object");
    }

    if (this.getProcessState() != null) {
      this.getProcessState().toPutObject(put, "content", "class", "data");
    }

    put.add("bigs", "status", Bytes.toBytes(this.getStatusAsString()));
    put.add(
        "scheduling", "parents", Bytes.toBytes(Text.collate(this.parentsRowkeys.toArray(), " ")));

    put.add("scheduling", "method", Bytes.toBytes(this.getMethodName()));

    lastUpdate = new Date(Core.getTime());

    put.add("bigs", "lastupdate", Bytes.toBytes(TextUtils.FULLDATE.format(this.lastUpdate)));

    if (this.elapsedTime != null) {
      put.add("bigs", "elapsedtime", Bytes.toBytes(this.elapsedTime.toString()));
    }

    if (this.tags != null) {
      for (String k : this.tags.keySet()) {
        String v = this.tags.get(k);
        if (v != null && !v.isEmpty()) {
          put.add("tags", k, Bytes.toBytes(v));
        }
      }
    }
    return put;
  }
예제 #4
0
  @Override
  public void run(String[] args) {

    Long explorationNumber = new Long(args[0]);
    Exploration expl = Exploration.fromExplorationNumber(explorationNumber);

    List<ExplorationStage> stages = expl.getStages();
    if (stages.size() == 0) {
      throw new BIGSException("no stages defined in exploratin file");
    }
    Log.info("Processing only stage one");
    ExplorationStage stage = stages.get(0);

    // creates the exploration configurations, repeats, etc.
    stage.saveEvaluations();
    Log.info(
        "Exploration "
            + explorationNumber
            + " generated and saved "
            + stage.generateEvaluations().size()
            + " evaluations ");

    // marks the source dataset for splitting
    Data.markSplits(
        stage.getConfiguredOriginDataSource(),
        stage.getOriginContainerName(),
        stage.getNumberOfSplits(),
        Text.zeroPad(explorationNumber));
    Log.info("marked data splits in source dataset");

    expl.setStatus(Exploration.STATUS_ACTIVE);
    expl.setTimeDone(null);
    expl.setTimeStart(null);
    expl.save();
    Log.info("exploration marked as active");
  }