/** * Get task states of {@link Task}s of this job as {@link WorkUnitState}s. * * @return a list of {@link WorkUnitState}s */ public List<WorkUnitState> getTaskStatesAsWorkUnitStates() { ImmutableList.Builder<WorkUnitState> builder = ImmutableList.builder(); for (TaskState taskState : this.taskStates.values()) { WorkUnitState workUnitState = new WorkUnitState(taskState.getWorkunit(), taskState.getJobState()); workUnitState.setId(taskState.getId()); workUnitState.addAll(taskState); builder.add(workUnitState); } return builder.build(); }
public ImmutableWorkUnitState(WorkUnitState workUnitState) { super(workUnitState.getWorkunit(), workUnitState.getJobState()); super.addAll(workUnitState.getSpecProperties()); }
/** * Merge this {@link ConstructState} into a {@link WorkUnitState}. All override properties will be added as-is to the * {@lik WorkUnitState}, and possibly override already present properties. All other properties have their keys * mutated key -> {@link #FINAL_CONSTRUCT_STATE_PREFIX} + key, and added to the {@link WorkUnitState}. */ public void mergeIntoWorkUnitState(WorkUnitState state) { Properties overwriteProperties = getOverwriteProperties(); state.addAll(overwriteProperties); removeProp(OVERWRITE_PROPS_KEY); for (String key : getPropertyNames()) { state.setProp(FINAL_CONSTRUCT_STATE_PREFIX + key, getProp(key)); } }
+ GobblinTrackingEventFlattenFilterConverter.FIELDS_TO_FLATTEN, "field1,field2"); WorkUnitState workUnitState = new WorkUnitState(); workUnitState.addAll(props); converter.init(workUnitState); Schema output = converter.convertSchema( workUnitState2.addAll(props); converter.init(workUnitState2); Schema output2 = converter.convertSchema(
/** * Copy WorkUnitState so that work unit also contains job state. FileBasedExtractor needs properties from job state (mostly source.* properties), * where it has been already removed when reached here. * * @param src * @return */ private WorkUnitState copyOf(WorkUnitState src) { WorkUnit copiedWorkUnit = WorkUnit.copyOf(src.getWorkunit()); copiedWorkUnit.addAllIfNotExist(src.getJobState()); WorkUnitState workUnitState = new WorkUnitState(copiedWorkUnit, src.getJobState()); workUnitState.addAll(src); return workUnitState; }
props.setProperty(SamplingConverter.SAMPLE_RATIO_KEY, "" + randomSampling); WorkUnitState workUnitState = new WorkUnitState(); workUnitState.addAll(props);
workUnitStateCopy.addAll(workUnitState); workUnitStateCopy.overrideWith(state); previousWorkUnitStates.add(workUnitStateCopy);
wus.addAll(sourceState);
state2.addAll(state);
/** * Get task states of {@link Task}s of this job as {@link WorkUnitState}s. * * @return a list of {@link WorkUnitState}s */ public List<WorkUnitState> getTaskStatesAsWorkUnitStates() { ImmutableList.Builder<WorkUnitState> builder = ImmutableList.builder(); for (TaskState taskState : this.taskStates.values()) { WorkUnitState workUnitState = new WorkUnitState(taskState.getWorkunit(), taskState.getJobState()); workUnitState.setId(taskState.getId()); workUnitState.addAll(taskState); builder.add(workUnitState); } return builder.build(); }
public ImmutableWorkUnitState(WorkUnitState workUnitState) { super(workUnitState.getWorkunit(), workUnitState.getJobState()); super.addAll(workUnitState.getSpecProperties()); }
/** * Merge this {@link ConstructState} into a {@link WorkUnitState}. All override properties will be added as-is to the * {@lik WorkUnitState}, and possibly override already present properties. All other properties have their keys * mutated key -> {@link #FINAL_CONSTRUCT_STATE_PREFIX} + key, and added to the {@link WorkUnitState}. */ public void mergeIntoWorkUnitState(WorkUnitState state) { Properties overwriteProperties = getOverwriteProperties(); state.addAll(overwriteProperties); removeProp(OVERWRITE_PROPS_KEY); for (String key : getPropertyNames()) { state.setProp(FINAL_CONSTRUCT_STATE_PREFIX + key, getProp(key)); } }
/** * Copy WorkUnitState so that work unit also contains job state. FileBasedExtractor needs properties from job state (mostly source.* properties), * where it has been already removed when reached here. * * @param src * @return */ private WorkUnitState copyOf(WorkUnitState src) { WorkUnit copiedWorkUnit = WorkUnit.copyOf(src.getWorkunit()); copiedWorkUnit.addAllIfNotExist(src.getJobState()); WorkUnitState workUnitState = new WorkUnitState(copiedWorkUnit, src.getJobState()); workUnitState.addAll(src); return workUnitState; }
workUnitStateCopy.addAll(workUnitState); workUnitStateCopy.overrideWith(state); previousWorkUnitStates.add(workUnitStateCopy);