/** * Get the {@link gobblin.source.workunit.Extract} associated with the {@link WorkUnit}. * * @return {@link gobblin.source.workunit.Extract} associated with the {@link WorkUnit} */ public Extract getExtract() { return new Extract(this.workUnit.getExtract()); }
/** * Copy constructor. * * @param other the other {@link WorkUnit} instance * * @deprecated Use {@link #copyOf(WorkUnit)} */ @Deprecated public WorkUnit(WorkUnit other) { super.addAll(other); this.extract = other.getExtract(); }
public ImmutableWorkUnit(WorkUnit workUnit) { super(workUnit.getExtract()); // Only copy the specProperties from the given workUnit. Properties specificPropertiesCopy = new Properties(); specificPropertiesCopy.putAll(workUnit.getSpecProperties()); super.setProps(workUnit.getCommonProperties(), specificPropertiesCopy); }
/** * Creates the default {@link Path} for the {@link ConfigurationKeys#WRITER_FILE_PATH} key. * @param numBranches is the total number of branches for the given {@link State}. * @param branchId is the id for the specific branch that the {@link gobblin.writer.DataWriter} will write to. * @return a {@link Path} specifying the directory where the {@link gobblin.writer.DataWriter} will write to. */ public static Path getDefaultWriterFilePath(State state, int numBranches, int branchId) { if (state instanceof WorkUnitState) { WorkUnitState workUnitState = (WorkUnitState) state; return new Path(ForkOperatorUtils.getPathForBranch(workUnitState, workUnitState.getExtract().getOutputFilePath(), numBranches, branchId)); } else if (state instanceof WorkUnit) { WorkUnit workUnit = (WorkUnit) state; return new Path(ForkOperatorUtils.getPathForBranch(workUnit, workUnit.getExtract().getOutputFilePath(), numBranches, branchId)); } throw new RuntimeException("In order to get the default value for " + ConfigurationKeys.WRITER_FILE_PATH + " the given state must be of type " + WorkUnitState.class.getName() + " or " + WorkUnit.class.getName()); }
Extract previousExtract = pre.getWorkunit().getExtract(); if (previousExtract.getNamespace().equals(namespace) && previousExtract.getTable().equals(table)) { this.previousTableState.addAll(pre);