[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484290
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/policy/SelectBetweenTimeBasedPolicy.java
 ##
 @@ -94,17 +100,25 @@ public SelectBetweenTimeBasedPolicy(Optional 
minLookBackPeriod, Optional
   public boolean apply(TimestampedDatasetVersion version) {
 return version.getDateTime()
 .plus(SelectBetweenTimeBasedPolicy.this.maxLookBackPeriod.or(new 
Period(DateTime.now().getMillis(
-.isAfterNow()
-&& 
version.getDateTime().plus(SelectBetweenTimeBasedPolicy.this.minLookBackPeriod.or(new
 Period(0)))
-.isBeforeNow();
+.isAfterNow() && version.getDateTime()
+.plus(SelectBetweenTimeBasedPolicy.this.minLookBackPeriod.or(new 
Period(0)))
+.isBeforeNow();
   }
 };
   }
 
   protected static Period getLookBackPeriod(String lookbackTime) {
 
 Review comment:
   Looks like this is just reformatting. Unless there is a reason to reformat, 
leave it as is. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484636
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -73,6 +71,7 @@
   private final VersionSelectionPolicy 
versionSelectionPolicy;
   private final ExecutorService executor;
   private final FileSystem srcFs;
+  private final CopyableFileFilter copyableFileFilter;
 
 Review comment:
   This class already has a method copyableFileFilter() that returns a 
HiddenFilter. You can use AndPathFilter to merge this filter with the filter 
specified in member variable copyableFileFilter. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483235
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 
isFileModifiedBtwLookBackPeriod(file.getOrigin().getModificationTime());
+  if (fileWithInModWindow) {
+filtered.add(file);
+  }
+}
+
+return filtered.build();
+  }
+
+  /**
+   *
+   * @param modTime file modification time in long.
+   * @return true if the file modification time between look back 
window;
+   * false if file modification time not between look 
back window.
 
 Review comment:
   Same comment as above.


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483057
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
 
 Review comment:
   "if file modified time..." -> "if file modification time is not within the 
lookback window"?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483538
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
 
 Review comment:
   Looks like most of the logic inside this class can be moved to a parent 
class that implements a "DateRangeFileFilter". ModTimeDateRangeFileFilter can 
extend this class and pass modification time to filter files. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483336
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 
isFileModifiedBtwLookBackPeriod(file.getOrigin().getModificationTime());
 
 Review comment:
   Drop the assignment and move it inside the if condition in the next 
statement.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484386
 
 

 ##
 File path: 
gobblin-data-management/src/test/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDatasetTest.java
 ##
 @@ -91,12 +110,82 @@ public void testConfigOptions() {
 TimeBasedCopyPolicyForTest.class.getName());
   }
 
+  @Test
+  public void testCopyWithFilter() throws IOException {
+
+/** source setup **/
+Path srcRoot = new Path(this.testTempPath, "src/slt/eqp/daily");
+
+if (this.localFs.exists(srcRoot)) {
+  this.localFs.delete(srcRoot, true);
+}
+
+List dateTimeList = Lists.newArrayList();
+IntStream.range(0, 4)
+.forEach(
+i -> dateTimeList.add(new 
DateTime(DateTimeZone.forID(ConfigurationKeys.PST_TIMEZONE_NAME)).minusDays(i)));
+
+String datePattern = "/MM/dd";
+DateTimeFormatter formatter = DateTimeFormat.forPattern(datePattern);
+
+for (DateTime dt : dateTimeList) {
+  String srcVersionPathStr = formatter.print(dt);
+  Path srcVersionPath = new Path(srcRoot, srcVersionPathStr);
+  this.localFs.mkdirs(srcVersionPath);
+
+  Path srcfile = new Path(srcVersionPath, "file1.avro");
+  this.localFs.create(srcfile);
+}
+
+/** destination setup **/
+Path destRoot = new Path(this.testTempPath, "dest/slt/eqp");
 
 Review comment:
   Change "dest/slt/eqp" pathname to some other dummy path.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483606
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -120,9 +118,10 @@ public TimestampBasedCopyableDataset(FileSystem fs, 
Properties props, Path datas
 Collection copyableVersions = 
this.versionSelectionPolicy.listSelectedVersions(versions);
 ConcurrentLinkedQueue copyableFileList = new 
ConcurrentLinkedQueue<>();
 List> futures = Lists.newArrayList();
+//this.copyableFileFilter.filter(this.fs, targetFs, copyableFiles)
 
 Review comment:
   Remove this comment..


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312734=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312734
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483538
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
 
 Review comment:
   Looks like most of the logic inside this class can be moved to a parent 
class that implements a "DateRangeFileFilter". ModTimeDateRangeFileFilter can 
extend this class and pass modification time to filter files. 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312734)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483226
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 
isFileModifiedBtwLookBackPeriod(file.getOrigin().getModificationTime());
+  if (fileWithInModWindow) {
+filtered.add(file);
+  }
+}
+
+return filtered.build();
+  }
+
+  /**
+   *
+   * @param modTime file modification time in long.
+   * @return true if the file modification time between look back 
window;
 
 Review comment:
   "between" -> "within"? and "look back" -> "lookback" ?



[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484757
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -134,7 +133,11 @@ public TimestampBasedCopyableDataset(FileSystem fs, 
Properties props, Path datas
 } finally {
   ExecutorsUtils.shutdownExecutorService(executor, Optional.of(log));
 }
-return copyableFileList;
+
+ConcurrentLinkedQueue copyableFilesFilteredList = new 
ConcurrentLinkedQueue<>();
 
 Review comment:
   Also, see the comment earlier about returning a merged path filter in 
TimeStampBasedCopyableDataset#copyFileFilter() method. That way, you can remove 
this filtering logic in the end.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312736=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312736
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484636
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -73,6 +71,7 @@
   private final VersionSelectionPolicy 
versionSelectionPolicy;
   private final ExecutorService executor;
   private final FileSystem srcFs;
+  private final CopyableFileFilter copyableFileFilter;
 
 Review comment:
   This class already has a method copyableFileFilter() that returns a 
HiddenFilter. You can use AndPathFilter to merge this filter with the filter 
specified in member variable copyableFileFilter. 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312736)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312740=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312740
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483336
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 

[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312743=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312743
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484757
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -134,7 +133,11 @@ public TimestampBasedCopyableDataset(FileSystem fs, 
Properties props, Path datas
 } finally {
   ExecutorsUtils.shutdownExecutorService(executor, Optional.of(log));
 }
-return copyableFileList;
+
+ConcurrentLinkedQueue copyableFilesFilteredList = new 
ConcurrentLinkedQueue<>();
 
 Review comment:
   Also, see the comment earlier about returning a merged path filter in 
TimeStampBasedCopyableDataset#copyFileFilter() method. That way, you can remove 
this filtering logic in the end.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312743)
Time Spent: 4h  (was: 3h 50m)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 4h
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312739=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312739
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484290
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/policy/SelectBetweenTimeBasedPolicy.java
 ##
 @@ -94,17 +100,25 @@ public SelectBetweenTimeBasedPolicy(Optional 
minLookBackPeriod, Optional
   public boolean apply(TimestampedDatasetVersion version) {
 return version.getDateTime()
 .plus(SelectBetweenTimeBasedPolicy.this.maxLookBackPeriod.or(new 
Period(DateTime.now().getMillis(
-.isAfterNow()
-&& 
version.getDateTime().plus(SelectBetweenTimeBasedPolicy.this.minLookBackPeriod.or(new
 Period(0)))
-.isBeforeNow();
+.isAfterNow() && version.getDateTime()
+.plus(SelectBetweenTimeBasedPolicy.this.minLookBackPeriod.or(new 
Period(0)))
+.isBeforeNow();
   }
 };
   }
 
   protected static Period getLookBackPeriod(String lookbackTime) {
 
 Review comment:
   Looks like this is just reformatting. Unless there is a reason to reformat, 
leave it as is. 
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312739)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312733=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312733
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483254
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 

[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312732=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312732
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483057
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
 
 Review comment:
   "if file modified time..." -> "if file modification time is not within the 
lookback window"?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312732)
Time Spent: 3h 20m  (was: 3h 10m)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 3h 20m
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312742=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312742
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483235
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 

[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312738=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312738
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324484386
 
 

 ##
 File path: 
gobblin-data-management/src/test/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDatasetTest.java
 ##
 @@ -91,12 +110,82 @@ public void testConfigOptions() {
 TimeBasedCopyPolicyForTest.class.getName());
   }
 
+  @Test
+  public void testCopyWithFilter() throws IOException {
+
+/** source setup **/
+Path srcRoot = new Path(this.testTempPath, "src/slt/eqp/daily");
+
+if (this.localFs.exists(srcRoot)) {
+  this.localFs.delete(srcRoot, true);
+}
+
+List dateTimeList = Lists.newArrayList();
+IntStream.range(0, 4)
+.forEach(
+i -> dateTimeList.add(new 
DateTime(DateTimeZone.forID(ConfigurationKeys.PST_TIMEZONE_NAME)).minusDays(i)));
+
+String datePattern = "/MM/dd";
+DateTimeFormatter formatter = DateTimeFormat.forPattern(datePattern);
+
+for (DateTime dt : dateTimeList) {
+  String srcVersionPathStr = formatter.print(dt);
+  Path srcVersionPath = new Path(srcRoot, srcVersionPathStr);
+  this.localFs.mkdirs(srcVersionPath);
+
+  Path srcfile = new Path(srcVersionPath, "file1.avro");
+  this.localFs.create(srcfile);
+}
+
+/** destination setup **/
+Path destRoot = new Path(this.testTempPath, "dest/slt/eqp");
 
 Review comment:
   Change "dest/slt/eqp" pathname to some other dummy path.
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312738)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312737=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312737
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483226
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 

[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483733
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -134,7 +133,11 @@ public TimestampBasedCopyableDataset(FileSystem fs, 
Properties props, Path datas
 } finally {
   ExecutorsUtils.shutdownExecutorService(executor, Optional.of(log));
 }
-return copyableFileList;
+
+ConcurrentLinkedQueue copyableFilesFilteredList = new 
ConcurrentLinkedQueue<>();
 
 Review comment:
   Do we need ConcurrentLinkedQueue? Seems like List should 
suffice?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature to support DistCP to copy files that were …

2019-09-15 Thread GitBox
sv2000 commented on a change in pull request #2633: GOBBLIN-759: Added feature 
to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483254
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/ModifiedDateRangeBasedFileFilter.java
 ##
 @@ -0,0 +1,116 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.gobblin.data.management.copy;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import lombok.extern.slf4j.Slf4j;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.joda.time.DateTime;
+import org.joda.time.DateTimeZone;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+
+import com.google.common.collect.ImmutableList;
+
+import org.apache.gobblin.configuration.ConfigurationKeys;
+
+
+/**
+ * A {@link CopyableFileFilter} that drops a {@link CopyableFile} if file 
modified time not between the loop back window
+ *  sourceFs
+ */
+@Slf4j
+public class ModifiedDateRangeBasedFileFilter implements CopyableFileFilter {
+
+  private final Properties props;
+  private Period minLookBackPeriod;
+  private Period maxLookBackPeriod;
+  private DateTime currentTime;
+  private DateTime minLookBackTime;
+  private DateTime maxLookBackTime;
+
+  public static final String CONFIGURATION_KEY_PREFIX = 
"gobblin.dataset.filter.";
+  public static final String MODIFIED_MIN_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.min.lookbackTime";
+  public static final String MODIFIED_MAX_LOOK_BACK_TIME_KEY =
+  CONFIGURATION_KEY_PREFIX + "selection.modified.max.lookbackTime";
+  public static final String DEFAULT_DATE_PATTERN_TIMEZONE = 
ConfigurationKeys.PST_TIMEZONE_NAME;
+  public static final String DATE_PATTERN_TIMEZONE_KEY = 
CONFIGURATION_KEY_PREFIX + "datetime.timezone";
+
+  public ModifiedDateRangeBasedFileFilter(Properties properties) {
+this.props = properties;
+PeriodFormatter periodFormatter =
+new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").appendHours().appendSuffix("h").toFormatter();
+this.minLookBackPeriod = 
props.containsKey(MODIFIED_MIN_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MIN_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().getMillis());
+this.maxLookBackPeriod = 
props.containsKey(MODIFIED_MAX_LOOK_BACK_TIME_KEY) ? 
periodFormatter.parsePeriod(
+props.getProperty(MODIFIED_MAX_LOOK_BACK_TIME_KEY)) : new 
Period(DateTime.now().minusDays(1).getMillis());
+this.currentTime = properties.containsKey(DATE_PATTERN_TIMEZONE_KEY) ? 
DateTime.now(
+DateTimeZone.forID(props.getProperty(DATE_PATTERN_TIMEZONE_KEY)))
+: DateTime.now(DateTimeZone.forID(DEFAULT_DATE_PATTERN_TIMEZONE));
+this.minLookBackTime = this.currentTime.minus(minLookBackPeriod);
+this.maxLookBackTime = this.currentTime.minus(maxLookBackPeriod);
+  }
+
+  /**
+   * For every {@link CopyableFile} in copyableFiles checks if a 
{@link CopyableFile#getOrigin()#getPath()#getModificationTime()}
+   * + date between the min and max look back window on sourceFs 
{@inheritDoc}
+   *
+   * @see CopyableFileFilter#filter(FileSystem,
+   *  FileSystem, Collection)
+   */
+  @Override
+  public Collection filter(FileSystem sourceFs, FileSystem 
targetFs,
+  Collection copyableFiles) {
+Iterator iterator = copyableFiles.iterator();
+
+ImmutableList.Builder filtered = ImmutableList.builder();
+
+while (iterator.hasNext()) {
+  CopyableFile file = iterator.next();
+  boolean fileWithInModWindow = 
isFileModifiedBtwLookBackPeriod(file.getOrigin().getModificationTime());
+  if (fileWithInModWindow) {
+filtered.add(file);
+  }
+}
+
+return filtered.build();
+  }
+
+  /**
+   *
+   * @param modTime file modification time in long.
+   * @return true if the file modification time between look back 
window;
+   * false if file modification time not between look 
back window.
+   *
+   */
+  private boolean isFileModifiedBtwLookBackPeriod(long 

[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312735=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312735
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483733
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -134,7 +133,11 @@ public TimestampBasedCopyableDataset(FileSystem fs, 
Properties props, Path datas
 } finally {
   ExecutorsUtils.shutdownExecutorService(executor, Optional.of(log));
 }
-return copyableFileList;
+
+ConcurrentLinkedQueue copyableFilesFilteredList = new 
ConcurrentLinkedQueue<>();
 
 Review comment:
   Do we need ConcurrentLinkedQueue? Seems like List should 
suffice?
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312735)
Time Spent: 3h 40m  (was: 3.5h)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 3h 40m
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (GOBBLIN-759) DistCP files modified in last n days within a look back period

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-759?focusedWorklogId=312741=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312741
 ]

ASF GitHub Bot logged work on GOBBLIN-759:
--

Author: ASF GitHub Bot
Created on: 15/Sep/19 22:47
Start Date: 15/Sep/19 22:47
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2633: GOBBLIN-759: 
Added feature to support DistCP to copy files that were …
URL: https://github.com/apache/incubator-gobblin/pull/2633#discussion_r324483606
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/TimestampBasedCopyableDataset.java
 ##
 @@ -120,9 +118,10 @@ public TimestampBasedCopyableDataset(FileSystem fs, 
Properties props, Path datas
 Collection copyableVersions = 
this.versionSelectionPolicy.listSelectedVersions(versions);
 ConcurrentLinkedQueue copyableFileList = new 
ConcurrentLinkedQueue<>();
 List> futures = Lists.newArrayList();
+//this.copyableFileFilter.filter(this.fs, targetFs, copyableFiles)
 
 Review comment:
   Remove this comment..
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312741)
Time Spent: 3h 50m  (was: 3h 40m)

> DistCP files modified in last n days within a look back period
> --
>
> Key: GOBBLIN-759
> URL: https://issues.apache.org/jira/browse/GOBBLIN-759
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Karthik Amarnath
>Priority: Major
>  Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> *Feature Request:*
>  # DistCP only the files modified in last n days within the look back window.
>  # DistCP will copy only the files modified even when the source file which 
> were NOT modified in last n days in the destination directory.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Work logged] (GOBBLIN-879) Refactor on BinPacker for better code reuse

2019-09-15 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/GOBBLIN-879?focusedWorklogId=312747=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-312747
 ]

ASF GitHub Bot logged work on GOBBLIN-879:
--

Author: ASF GitHub Bot
Created on: 16/Sep/19 00:01
Start Date: 16/Sep/19 00:01
Worklog Time Spent: 10m 
  Work Description: asfgit commented on pull request #2732: [GOBBLIN-879] 
Refactor bin-packer for better code reuse
URL: https://github.com/apache/incubator-gobblin/pull/2732
 
 
   
 

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
---

Worklog Id: (was: 312747)
Time Spent: 0.5h  (was: 20m)

> Refactor on BinPacker for better code reuse
> ---
>
> Key: GOBBLIN-879
> URL: https://issues.apache.org/jira/browse/GOBBLIN-879
> Project: Apache Gobblin
>  Issue Type: Improvement
>Reporter: Lei Sun
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[GitHub] [incubator-gobblin] asfgit closed pull request #2732: [GOBBLIN-879] Refactor bin-packer for better code reuse

2019-09-15 Thread GitBox
asfgit closed pull request #2732: [GOBBLIN-879] Refactor bin-packer for better 
code reuse
URL: https://github.com/apache/incubator-gobblin/pull/2732
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services