/** * Creates a unique {@link String} representing this branch. */ private static String getForkMetricsId(State state, int index) { return state.getProp(ConfigurationKeys.FORK_BRANCH_NAME_KEY + "." + index, ConfigurationKeys.DEFAULT_FORK_BRANCH_NAME + index); }
/** * @deprecated Use {@link #getProp(String)} */ @Deprecated protected String getProperty(String key) { return getProp(key); }
private String getSubDirPattern() { String subdirPattern = this.state.getProp(COMPACTION_TIMEBASED_SUBDIR_PATTERN, DEFAULT_COMPACTION_TIMEBASED_SUBDIR_PATTERN); log.info("Compaction subdir pattern: " + subdirPattern); return subdirPattern; }
/** * Get the value of a property as a list of strings, using the given default value if the property is not set. * * @param key property key * @param def default value * @return value (the default value if the property is not set) associated with the key as a list of strings */ public List<String> getPropAsList(String key, String def) { return LIST_SPLITTER.splitToList(getProp(key, def)); }
/** * Get the value of a property as a short. * * @param key property key * @param radix radix used to parse the value * @return short value associated with the key */ public short getPropAsShortWithRadix(String key, int radix) { return Short.parseShort(getProp(key), radix); }
/** * Get the value of a property as a case insensitive {@link Set} of strings. * * @param key property key * @return value associated with the key as a case insensitive {@link Set} of strings */ public Set<String> getPropAsCaseInsensitiveSet(String key) { return ImmutableSortedSet.copyOf(String.CASE_INSENSITIVE_ORDER, LIST_SPLITTER.split(getProp(key))); }
/** * Get the value of a property as a double, using the given default value if the property is not set. * * @param key property key * @param def default value * @return double value associated with the key or the default value if the property is not set */ public double getPropAsDouble(String key, double def) { return Double.parseDouble(getProp(key, String.valueOf(def))); }
/** * Get the value of a comma separated property as a {@link Set} of strings. * * @param key property key * @param def default value * @return value (the default value if the property is not set) associated with the key as a {@link Set} of strings */ public Set<String> getPropAsSet(String key, String def) { return ImmutableSet.copyOf(LIST_SPLITTER.splitToList(getProp(key, def))); }
/** * Get the value of a property as an integer, using the given default value if the property is not set. * * @param key property key * @param def default value * @return integer value associated with the key or the default value if the property is not set */ public int getPropAsInt(String key, int def) { return Integer.parseInt(getProp(key, String.valueOf(def))); }
/** * Get the value of a property as an short, using the given default value if the property is not set. * * @param key property key * @param def default value * @return short value associated with the key or the default value if the property is not set */ public short getPropAsShort(String key, short def) { return Short.parseShort(getProp(key, String.valueOf(def))); }
private static WriterFilePathType getWriterFilePathType(State state) { String pathTypeStr = state.getProp(ConfigurationKeys.WRITER_FILE_PATH_TYPE, ConfigurationKeys.DEFAULT_WRITER_FILE_PATH_TYPE); return WriterFilePathType.valueOf(pathTypeStr.toUpperCase()); }
/** * Creates {@link Path} for the {@link ConfigurationKeys#WRITER_FILE_PATH} key according to * {@link ConfigurationKeys#EXTRACT_TABLE_NAME_KEY}. * @param state * @return */ public static Path getTableNameWriterFilePath(State state) { Preconditions.checkArgument(state.contains(ConfigurationKeys.EXTRACT_TABLE_NAME_KEY)); return new Path(state.getProp(ConfigurationKeys.EXTRACT_TABLE_NAME_KEY)); }
@SuppressWarnings("unchecked") private Class<? extends AbstractRunner> getRunnerClass() { Preconditions.checkArgument(this.props.contains(COMPACTION_COMPLETENESS_VERIFICATION_CLASS), "Missing required property " + COMPACTION_COMPLETENESS_VERIFICATION_CLASS); try { return (Class<? extends AbstractRunner>) Class .forName(this.props.getProp(COMPACTION_COMPLETENESS_VERIFICATION_CLASS)); } catch (Throwable t) { LOG.error("Failed to get data completeness verification class", t); throw Throwables.propagate(t); } }
private String getSrcBaseDir(State state) { Preconditions.checkArgument(state.contains(MRCompactor.COMPACTION_INPUT_DIR), "Missing required property " + MRCompactor.COMPACTION_INPUT_DIR); return state.getProp(MRCompactor.COMPACTION_INPUT_DIR); }
/** * Get the value of a property as an short, using the given default value if the property is not set. * * @param key property key * @param def default value * @param radix radix used to parse the value * @return short value associated with the key or the default value if the property is not set */ public short getPropAsShortWithRadix(String key, short def, int radix) { return contains(key) ? Short.parseShort(getProp(key), radix) : def; }
public static ExecutionModel getExecutionModel(State state) { String mode = state .getProp(TaskConfigurationKeys.TASK_EXECUTION_MODE, TaskConfigurationKeys.DEFAULT_TASK_EXECUTION_MODE); try { return ExecutionModel.valueOf(mode.toUpperCase()); } catch (Exception e) { LOG.warn("Could not find an execution model corresponding to {}, returning {}", mode, ExecutionModel.BATCH, e); return ExecutionModel.BATCH; } }
/** * Refer to {@link MRCompactorAvroKeyDedupJobRunner#getDedupKeyOption()} */ private MRCompactorAvroKeyDedupJobRunner.DedupKeyOption getDedupKeyOption() { if (!this.state.contains(MRCompactorAvroKeyDedupJobRunner.COMPACTION_JOB_DEDUP_KEY)) { return MRCompactorAvroKeyDedupJobRunner.DEFAULT_DEDUP_KEY_OPTION; } Optional<MRCompactorAvroKeyDedupJobRunner.DedupKeyOption> option = Enums.getIfPresent(MRCompactorAvroKeyDedupJobRunner.DedupKeyOption.class, this.state.getProp(MRCompactorAvroKeyDedupJobRunner.COMPACTION_JOB_DEDUP_KEY).toUpperCase()); return option.isPresent() ? option.get() : MRCompactorAvroKeyDedupJobRunner.DEFAULT_DEDUP_KEY_OPTION; }
protected FileSystem getSourceFileSystem(State state) throws IOException { Configuration conf = HadoopUtils.getConfFromState(state); String uri = state.getProp(ConfigurationKeys.SOURCE_FILEBASED_FS_URI, ConfigurationKeys.LOCAL_FS_URI); return HadoopUtils.getOptionallyThrottledFileSystem(FileSystem.get(URI.create(uri), conf), state); }
private CombineOperation getConditionOperation (Dataset dataset) { String oprName = dataset.jobProps().getProp (MRCompactor.COMPACTION_RECOMPACT_COMBINE_CONDITIONS_OPERATION, MRCompactor.DEFAULT_COMPACTION_RECOMPACT_COMBINE_CONDITIONS_OPERATION); try { CombineOperation opr = CombineOperation.valueOf (oprName.toUpperCase()); return opr; } catch (Exception e) { return CombineOperation.OR; } }