List of usage examples for org.joda.time DateTimeZone forID
@FromString public static DateTimeZone forID(String id)
From source file:gobblin.compaction.dataset.DatasetHelper.java
License:Apache License
public DateTime getCurrentTime() { DateTimeZone timeZone = DateTimeZone.forID(this.dataset.jobProps().getProp(MRCompactor.COMPACTION_TIMEZONE, MRCompactor.DEFAULT_COMPACTION_TIMEZONE)); DateTime currentTime = new DateTime(timeZone); return currentTime; }
From source file:gobblin.compaction.dataset.TimeBasedSubDirDatasetsFinder.java
License:Apache License
@VisibleForTesting public TimeBasedSubDirDatasetsFinder(State state, FileSystem fs) throws Exception { super(state, fs); this.inputSubDir = getInputSubDir(); this.inputLateSubDir = getInputLateSubDir(); this.destSubDir = getDestSubDir(); this.destLateSubDir = getDestLateSubDir(); this.folderTimePattern = getFolderPattern(); this.subDirPattern = getSubDirPattern(); this.timeZone = DateTimeZone.forID( this.state.getProp(MRCompactor.COMPACTION_TIMEZONE, MRCompactor.DEFAULT_COMPACTION_TIMEZONE)); this.timeFormatter = DateTimeFormat.forPattern(this.folderTimePattern).withZone(this.timeZone); }
From source file:gobblin.compaction.dataset.TimeBasedSubDirDatasetsFinder.java
License:Apache License
public TimeBasedSubDirDatasetsFinder(State state) throws Exception { super(state); this.inputSubDir = getInputSubDir(); this.inputLateSubDir = getInputLateSubDir(); this.destSubDir = getDestSubDir(); this.destLateSubDir = getDestLateSubDir(); this.folderTimePattern = getFolderPattern(); this.subDirPattern = getSubDirPattern(); this.timeZone = DateTimeZone.forID( this.state.getProp(MRCompactor.COMPACTION_TIMEZONE, MRCompactor.DEFAULT_COMPACTION_TIMEZONE)); this.timeFormatter = DateTimeFormat.forPattern(this.folderTimePattern).withZone(this.timeZone); }
From source file:gobblin.compaction.mapreduce.MRCompactor.java
License:Apache License
private DateTime getCurrentTime() { DateTimeZone timeZone = DateTimeZone.forID( this.state.getProp(MRCompactor.COMPACTION_TIMEZONE, MRCompactor.DEFAULT_COMPACTION_TIMEZONE)); return new DateTime(timeZone); }
From source file:gobblin.compaction.mapreduce.MRCompactorJobRunner.java
License:Apache License
/** * For regular compactions, compaction timestamp is the time the compaction job starts. * * If this is a recompaction from output paths, the compaction timestamp will remain the same as previously * persisted compaction time. This is because such a recompaction doesn't consume input data, so next time, * whether a file in the input folder is considered late file should still be based on the previous compaction * timestamp./*from ww w. j a va 2 s . co m*/ */ private DateTime getCompactionTimestamp() throws IOException { DateTimeZone timeZone = DateTimeZone.forID(this.dataset.jobProps().getProp(MRCompactor.COMPACTION_TIMEZONE, MRCompactor.DEFAULT_COMPACTION_TIMEZONE)); if (!this.recompactFromDestPaths) { return new DateTime(timeZone); } Set<Path> inputPaths = getInputPaths(); long maxTimestamp = Long.MIN_VALUE; for (FileStatus status : FileListUtils.listFilesRecursively(this.fs, inputPaths)) { maxTimestamp = Math.max(maxTimestamp, status.getModificationTime()); } return maxTimestamp == Long.MIN_VALUE ? new DateTime(timeZone) : new DateTime(maxTimestamp, timeZone); }
From source file:gobblin.compaction.mapreduce.MRCompactorTimeBasedJobPropCreator.java
License:Open Source License
MRCompactorTimeBasedJobPropCreator(Builder builder) { super(builder); this.folderTimePattern = getFolderPattern(); this.timeZone = DateTimeZone.forID(this.state.getProp(ConfigurationKeys.COMPACTION_TIMEZONE, ConfigurationKeys.DEFAULT_COMPACTION_TIMEZONE)); this.timeFormatter = DateTimeFormat.forPattern(this.folderTimePattern).withZone(this.timeZone); }
From source file:gobblin.converter.avro.JsonElementConversionFactory.java
License:Apache License
private static DateTimeZone getTimeZone(String id) { DateTimeZone zone;/* ww w.j a va2s . c om*/ try { zone = DateTimeZone.forID(id); } catch (IllegalArgumentException e) { TimeZone timeZone = ZoneInfo.getTimeZone(id); //throw error if unrecognized zone if (timeZone == null) { throw new IllegalArgumentException("TimeZone " + id + " not recognized"); } zone = DateTimeZone.forTimeZone(timeZone); } return zone; }
From source file:gobblin.data.management.version.finder.DatePartitionHiveVersionFinder.java
License:Apache License
public DatePartitionHiveVersionFinder(FileSystem fs, Config config) { this.pattern = ConfigUtils.getString(config, PARTITION_VALUE_DATE_TIME_PATTERN_KEY, DEFAULT_PARTITION_VALUE_DATE_TIME_PATTERN); if (config.hasPath(PARTITION_VALUE_DATE_TIME_TIMEZONE_KEY)) { this.formatter = DateTimeFormat.forPattern(pattern) .withZone(DateTimeZone.forID(config.getString(PARTITION_VALUE_DATE_TIME_TIMEZONE_KEY))); } else {/*from w w w . j av a2 s . c o m*/ this.formatter = DateTimeFormat.forPattern(pattern) .withZone(DateTimeZone.forID(DEFAULT_PARTITION_VALUE_DATE_TIME_TIMEZONE)); } this.partitionKeyName = ConfigUtils.getString(config, PARTITION_KEY_NAME_KEY, DEFAULT_PARTITION_KEY_NAME); this.partitionKeyNamePredicate = new Predicate<FieldSchema>() { @Override public boolean apply(FieldSchema input) { return StringUtils.equalsIgnoreCase(input.getName(), DatePartitionHiveVersionFinder.this.partitionKeyName); } }; }
From source file:gobblin.data.management.version.finder.DateTimeDatasetVersionFinder.java
License:Apache License
public DateTimeDatasetVersionFinder(FileSystem fs, Config config) { super(fs);/* w w w . j a v a2 s . c om*/ Preconditions.checkArgument(config.hasPath(DATE_TIME_PATTERN_KEY), "Missing required property " + DATE_TIME_PATTERN_KEY); String pattern = config.getString(DATE_TIME_PATTERN_KEY); if (config.hasPath(OPTIONAL_GLOB_PATTERN_TIMEZONE_KEY)) { this.globPattern = new Path(config.getString(OPTIONAL_GLOB_PATTERN_TIMEZONE_KEY)); } else { this.globPattern = new Path(pattern.replaceAll("[^/]+", "*")); } LOGGER.debug(String.format("Setting timezone for patthern: %s. By default it is %s", pattern, DEFAULT_DATE_TIME_PATTERN_TIMEZONE)); if (config.hasPath(DATE_TIME_PATTERN_TIMEZONE_KEY)) { this.formatter = DateTimeFormat.forPattern(pattern) .withZone(DateTimeZone.forID(config.getString(DATE_TIME_PATTERN_TIMEZONE_KEY))); } else { this.formatter = DateTimeFormat.forPattern(pattern) .withZone(DateTimeZone.forID(DEFAULT_DATE_TIME_PATTERN_TIMEZONE)); } this.datePartitionPattern = pattern; }
From source file:gobblin.policies.time.RecordTimestampLowerBoundPolicy.java
License:Apache License
public RecordTimestampLowerBoundPolicy(State state, Type type) { super(state, type); this.partitioner = getPartitioner(); this.timeZone = DateTimeZone.forID(state.getProp(ConfigurationKeys.QUALITY_CHECKER_TIMEZONE, ConfigurationKeys.DEFAULT_QUALITY_CHECKER_TIMEZONE)); this.earliestAllowedTimestamp = getEarliestAllowedTimestamp(); }