[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-18 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 22:34
Start Date: 18/Oct/19 22:34
Worklog Time Spent: 10m 
  Work Description: vikrambohra commented on pull request #2772: 
[GOBBLIN-910] Added Unix timestamp based dataset finder using version selection 
policy
URL: https://github.com/apache/incubator-gobblin/pull/2772
 
 
   
 

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: 330810)
Time Spent: 2h 40m  (was: 2.5h)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-18 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 21:51
Start Date: 18/Oct/19 21:51
Worklog Time Spent: 10m 
  Work Description: vikrambohra commented on pull request #2772: 
[GOBBLIN-910] Added Unix timestamp based dataset finder using version selection 
policy
URL: https://github.com/apache/incubator-gobblin/pull/2772
 
 
   Dear Gobblin maintainers,
   
   Please accept this PR. I understand that it will not be reviewed until I 
have checked off all the steps below!
   
   
   ### JIRA
   - [ ] My PR addresses the following 
[GOBBLIN-910](https://issues.apache.org/jira/browse/GOBBLIN/) issues and 
references them in the PR title. For example, "[GOBBLIN-910] My Gobblin PR"
   - https://issues.apache.org/jira/browse/GOBBLIN-910
   
   
   ### Description
   - [ ] Here are some details about my PR, including screenshots (if 
applicable):
   Please refer to PR https://github.com/apache/incubator-gobblin/pull/2765
   
   ### Tests
   - [ ] My PR adds the following unit tests __OR__ does not need testing for 
this extremely good reason:
   Please refer to PR https://github.com/apache/incubator-gobblin/pull/2765
   
   ### Commits
   - [ ] My commits all reference JIRA issues in their subject lines, and I 
have squashed multiple commits if they address the same issue. In addition, my 
commits follow the guidelines from "[How to write a good git commit 
message](http://chris.beams.io/posts/git-commit/)":
   1. Subject is separated from body by a blank line
   2. Subject is limited to 50 characters
   3. Subject does not end with a period
   4. Subject uses the imperative mood ("add", not "adding")
   5. Body wraps at 72 characters
   6. Body explains "what" and "why", not "how"
   
   
 

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: 330795)
Time Spent: 2.5h  (was: 2h 20m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-18 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 17:43
Start Date: 18/Oct/19 17:43
Worklog Time Spent: 10m 
  Work Description: asfgit commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765
 
 
   
 

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: 330683)
Time Spent: 2h 20m  (was: 2h 10m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 05:40
Start Date: 18/Oct/19 05:40
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r336319876
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,160 @@
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import javafx.util.Pair;
+
+import org.apache.gobblin.util.PathUtils;
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset filters file paths based on a {@link #timestampPattern} and 
{@link #snapshotSelectionPolicy}
+ *
+ * The default regex will match the first occurrence of a directory matching 
the pattern after the dataset root
+ *
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEX = 
".*/([0-9]{13})-PT-.*/.*";
+  private final String lookbackTime;
+  private final Period lookbackPeriod;
+  private final LocalDateTime currentTime;
+  private final SnapshotSelectionPolicy snapshotSelectionPolicy;
+  private final DateTimeZone dateTimeZone;
+  private final Pattern timestampPattern;
+
+  public UnixTimestampRecursiveCopyableDataset(FileSystem fs, Path rootPath, 
Properties properties, Path glob) {
+super(fs, rootPath, properties, glob);
+this.lookbackTime = 
properties.getProperty(TimeAwareRecursiveCopyableDataset.LOOKBACK_TIME_KEY);
+this.snapshotSelectionPolicy =
+
SnapshotSelectionPolicy.valueOf(properties.getProperty(SNAPSHOT_SELECTION_POLICY).toUpperCase());
+PeriodFormatter periodFormatter = new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").toFormatter();
+this.lookbackPeriod = periodFormatter.parsePeriod(lookbackTime);
+String timestampRegex = properties.getProperty(TIMESTAMP_REGEEX, 
DEFAULT_TIMESTAMP_REGEX);
+this.timestampPattern = Pattern.compile(timestampRegex);
+this.dateTimeZone = DateTimeZone.forID(properties
+
.getProperty(TimeAwareRecursiveCopyableDataset.DATE_PATTERN_TIMEZONE_KEY,
+TimeAwareRecursiveCopyableDataset.DEFAULT_DATE_PATTERN_TIMEZONE));
+this.currentTime = LocalDateTime.now(this.dateTimeZone);
+  }
+
+  private enum SnapshotSelectionPolicy {
+EARLIEST, LATEST, ALL
+  }
+
+  class TimestampPathFilter implements PathFilter {
+
+@Override
+public boolean accept(Path path) {
+
+  LocalDate endDate = currentTime.toLocalDate();
+  LocalDate startDate = endDate.minus(lookbackPeriod);
+  Path relativePath = 
PathUtils.relativizePath(PathUtils.getPathWithoutSchemeAndAuthority(path), 
datasetRoot());
+  Matcher matcher = 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 05:40
Start Date: 18/Oct/19 05:40
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r336319720
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,160 @@
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import javafx.util.Pair;
+
+import org.apache.gobblin.util.PathUtils;
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset filters file paths based on a {@link #timestampPattern} and 
{@link #snapshotSelectionPolicy}
+ *
+ * The default regex will match the first occurrence of a directory matching 
the pattern after the dataset root
+ *
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
 
 Review comment:
   SNAPSHOT_SELECTION_POLICY -> VERSION_SELECTION_POLICY?
 

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: 330309)
Time Spent: 2h 10m  (was: 2h)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 05:40
Start Date: 18/Oct/19 05:40
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r336319248
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,160 @@
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import javafx.util.Pair;
+
+import org.apache.gobblin.util.PathUtils;
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset filters file paths based on a {@link #timestampPattern} and 
{@link #snapshotSelectionPolicy}
+ *
+ * The default regex will match the first occurrence of a directory matching 
the pattern after the dataset root
+ *
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEX = 
".*/([0-9]{13})-PT-.*/.*";
 
 Review comment:
   Why -PT-? Why not ".*/([0-9]{13}).*/.*" ?
 

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: 330306)
Time Spent: 2h  (was: 1h 50m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 2h
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 05:40
Start Date: 18/Oct/19 05:40
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r336319835
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,160 @@
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import javafx.util.Pair;
+
+import org.apache.gobblin.util.PathUtils;
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset filters file paths based on a {@link #timestampPattern} and 
{@link #snapshotSelectionPolicy}
+ *
+ * The default regex will match the first occurrence of a directory matching 
the pattern after the dataset root
+ *
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEX = 
".*/([0-9]{13})-PT-.*/.*";
+  private final String lookbackTime;
+  private final Period lookbackPeriod;
+  private final LocalDateTime currentTime;
+  private final SnapshotSelectionPolicy snapshotSelectionPolicy;
+  private final DateTimeZone dateTimeZone;
+  private final Pattern timestampPattern;
+
+  public UnixTimestampRecursiveCopyableDataset(FileSystem fs, Path rootPath, 
Properties properties, Path glob) {
+super(fs, rootPath, properties, glob);
+this.lookbackTime = 
properties.getProperty(TimeAwareRecursiveCopyableDataset.LOOKBACK_TIME_KEY);
+this.snapshotSelectionPolicy =
+
SnapshotSelectionPolicy.valueOf(properties.getProperty(SNAPSHOT_SELECTION_POLICY).toUpperCase());
+PeriodFormatter periodFormatter = new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").toFormatter();
+this.lookbackPeriod = periodFormatter.parsePeriod(lookbackTime);
+String timestampRegex = properties.getProperty(TIMESTAMP_REGEEX, 
DEFAULT_TIMESTAMP_REGEX);
+this.timestampPattern = Pattern.compile(timestampRegex);
+this.dateTimeZone = DateTimeZone.forID(properties
+
.getProperty(TimeAwareRecursiveCopyableDataset.DATE_PATTERN_TIMEZONE_KEY,
+TimeAwareRecursiveCopyableDataset.DEFAULT_DATE_PATTERN_TIMEZONE));
+this.currentTime = LocalDateTime.now(this.dateTimeZone);
+  }
+
+  private enum SnapshotSelectionPolicy {
+EARLIEST, LATEST, ALL
+  }
+
+  class TimestampPathFilter implements PathFilter {
+
+@Override
+public boolean accept(Path path) {
+
+  LocalDate endDate = currentTime.toLocalDate();
+  LocalDate startDate = endDate.minus(lookbackPeriod);
+  Path relativePath = 
PathUtils.relativizePath(PathUtils.getPathWithoutSchemeAndAuthority(path), 
datasetRoot());
+  Matcher matcher = 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 05:40
Start Date: 18/Oct/19 05:40
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r336320953
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,160 @@
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import javafx.util.Pair;
+
+import org.apache.gobblin.util.PathUtils;
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset filters file paths based on a {@link #timestampPattern} and 
{@link #snapshotSelectionPolicy}
+ *
+ * The default regex will match the first occurrence of a directory matching 
the pattern after the dataset root
+ *
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEX = 
".*/([0-9]{13})-PT-.*/.*";
+  private final String lookbackTime;
+  private final Period lookbackPeriod;
+  private final LocalDateTime currentTime;
+  private final SnapshotSelectionPolicy snapshotSelectionPolicy;
+  private final DateTimeZone dateTimeZone;
+  private final Pattern timestampPattern;
+
+  public UnixTimestampRecursiveCopyableDataset(FileSystem fs, Path rootPath, 
Properties properties, Path glob) {
+super(fs, rootPath, properties, glob);
+this.lookbackTime = 
properties.getProperty(TimeAwareRecursiveCopyableDataset.LOOKBACK_TIME_KEY);
+this.snapshotSelectionPolicy =
+
SnapshotSelectionPolicy.valueOf(properties.getProperty(SNAPSHOT_SELECTION_POLICY).toUpperCase());
+PeriodFormatter periodFormatter = new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").toFormatter();
+this.lookbackPeriod = periodFormatter.parsePeriod(lookbackTime);
+String timestampRegex = properties.getProperty(TIMESTAMP_REGEEX, 
DEFAULT_TIMESTAMP_REGEX);
+this.timestampPattern = Pattern.compile(timestampRegex);
+this.dateTimeZone = DateTimeZone.forID(properties
+
.getProperty(TimeAwareRecursiveCopyableDataset.DATE_PATTERN_TIMEZONE_KEY,
+TimeAwareRecursiveCopyableDataset.DEFAULT_DATE_PATTERN_TIMEZONE));
+this.currentTime = LocalDateTime.now(this.dateTimeZone);
+  }
+
+  private enum SnapshotSelectionPolicy {
+EARLIEST, LATEST, ALL
+  }
+
+  class TimestampPathFilter implements PathFilter {
 
 Review comment:
   Add javadoc to explain the behavior of this filter.
 

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 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 05:40
Start Date: 18/Oct/19 05:40
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r336319618
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,160 @@
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import javafx.util.Pair;
+
+import org.apache.gobblin.util.PathUtils;
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset filters file paths based on a {@link #timestampPattern} and 
{@link #snapshotSelectionPolicy}
+ *
+ * The default regex will match the first occurrence of a directory matching 
the pattern after the dataset root
+ *
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEX = 
".*/([0-9]{13})-PT-.*/.*";
+  private final String lookbackTime;
+  private final Period lookbackPeriod;
+  private final LocalDateTime currentTime;
+  private final SnapshotSelectionPolicy snapshotSelectionPolicy;
+  private final DateTimeZone dateTimeZone;
+  private final Pattern timestampPattern;
+
+  public UnixTimestampRecursiveCopyableDataset(FileSystem fs, Path rootPath, 
Properties properties, Path glob) {
+super(fs, rootPath, properties, glob);
+this.lookbackTime = 
properties.getProperty(TimeAwareRecursiveCopyableDataset.LOOKBACK_TIME_KEY);
+this.snapshotSelectionPolicy =
+
SnapshotSelectionPolicy.valueOf(properties.getProperty(SNAPSHOT_SELECTION_POLICY).toUpperCase());
+PeriodFormatter periodFormatter = new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").toFormatter();
+this.lookbackPeriod = periodFormatter.parsePeriod(lookbackTime);
+String timestampRegex = properties.getProperty(TIMESTAMP_REGEEX, 
DEFAULT_TIMESTAMP_REGEX);
+this.timestampPattern = Pattern.compile(timestampRegex);
+this.dateTimeZone = DateTimeZone.forID(properties
+
.getProperty(TimeAwareRecursiveCopyableDataset.DATE_PATTERN_TIMEZONE_KEY,
+TimeAwareRecursiveCopyableDataset.DEFAULT_DATE_PATTERN_TIMEZONE));
+this.currentTime = LocalDateTime.now(this.dateTimeZone);
+  }
+
+  private enum SnapshotSelectionPolicy {
+EARLIEST, LATEST, ALL
+  }
+
+  class TimestampPathFilter implements PathFilter {
+
+@Override
+public boolean accept(Path path) {
+
+  LocalDate endDate = currentTime.toLocalDate();
+  LocalDate startDate = endDate.minus(lookbackPeriod);
+  Path relativePath = 
PathUtils.relativizePath(PathUtils.getPathWithoutSchemeAndAuthority(path), 
datasetRoot());
+  Matcher matcher = 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 04:46
Start Date: 18/Oct/19 04:46
Worklog Time Spent: 10m 
  Work Description: vikrambohra commented on issue #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: 
https://github.com/apache/incubator-gobblin/pull/2765#issuecomment-543501223
 
 
   I just did a pull from upstream master before pushing.
   
   On Thu, Oct 17, 2019 at 9:45 PM Sudarshan Vasudevan <
   notificati...@github.com> wrote:
   
   > @vikrambohra  there are some unrelated
   > changes that have been pulled into this PR. Can you back out those
   > unrelated changes?
   >
   > —
   > You are receiving this because you were mentioned.
   > Reply to this email directly, view it on GitHub
   > 
,
   > or unsubscribe
   > 

   > .
   >
   -- 
   Vikram Bohra
   Tel: 352-284-1403
   
 

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: 330283)
Time Spent: 1h 40m  (was: 1.5h)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 1h 40m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 04:45
Start Date: 18/Oct/19 04:45
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on issue #2765: [GOBBLIN-910] Added a 
unix timestamp recursive copyable dataset finder
URL: 
https://github.com/apache/incubator-gobblin/pull/2765#issuecomment-543500794
 
 
   @vikrambohra there are some unrelated changes that have been pulled into 
this PR. Can you back out those unrelated changes?
 

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: 330281)
Time Spent: 1.5h  (was: 1h 20m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 02:06
Start Date: 18/Oct/19 02:06
Worklog Time Spent: 10m 
  Work Description: codecov-io commented on issue #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: 
https://github.com/apache/incubator-gobblin/pull/2765#issuecomment-542454409
 
 
   # 
[Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=h1)
 Report
   > Merging 
[#2765](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=desc)
 into 
[master](https://codecov.io/gh/apache/incubator-gobblin/commit/b92f516a4e7a9b2c8bd2e90d71026fb07cb56da7?src=pr=desc)
 will **increase** coverage by `0.03%`.
   > The diff coverage is `85.71%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/graphs/tree.svg?width=650=4MgURJ0bGc=150=pr)](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=tree)
   
   ```diff
   @@ Coverage Diff  @@
   ## master#2765  +/-   ##
   
   + Coverage  45.3%   45.33%   +0.03% 
   - Complexity 8846 8858  +12 
   
 Files  1892 1894   +2 
 Lines 7075270815  +63 
 Branches   7773 7784  +11 
   
   + Hits  3205432106  +52 
   - Misses3574035747   +7 
   - Partials   2958 2962   +4
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=tree) 
| Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | 
[...ement/copy/UnixTimestampCopyableDatasetFinder.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvVW5peFRpbWVzdGFtcENvcHlhYmxlRGF0YXNldEZpbmRlci5qYXZh)
 | `100% <100%> (ø)` | `2 <2> (?)` | |
   | 
[...nt/copy/UnixTimestampRecursiveCopyableDataset.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvVW5peFRpbWVzdGFtcFJlY3Vyc2l2ZUNvcHlhYmxlRGF0YXNldC5qYXZh)
 | `85% <85%> (ø)` | `8 <8> (?)` | |
   | 
[...in/java/org/apache/gobblin/cluster/HelixUtils.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhVdGlscy5qYXZh)
 | `35.51% <0%> (-3.74%)` | `12% <0%> (-1%)` | |
   | 
[...lin/elasticsearch/writer/FutureCallbackHolder.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1tb2R1bGVzL2dvYmJsaW4tZWxhc3RpY3NlYXJjaC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvZ29iYmxpbi9lbGFzdGljc2VhcmNoL3dyaXRlci9GdXR1cmVDYWxsYmFja0hvbGRlci5qYXZh)
 | `61.42% <0%> (-1.43%)` | `4% <0%> (ø)` | |
   | 
[.../org/apache/gobblin/metrics/RootMetricContext.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1tZXRyaWNzLWxpYnMvZ29iYmxpbi1tZXRyaWNzLWJhc2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vbWV0cmljcy9Sb290TWV0cmljQ29udGV4dC5qYXZh)
 | `79.68% <0%> (+1.56%)` | `16% <0%> (+1%)` | :arrow_up: |
   | 
[...lin/util/filesystem/FileSystemInstrumentation.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi11dGlsaXR5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3V0aWwvZmlsZXN5c3RlbS9GaWxlU3lzdGVtSW5zdHJ1bWVudGF0aW9uLmphdmE=)
 | `100% <0%> (+7.14%)` | `4% <0%> (+1%)` | :arrow_up: |
   | 
[...a/org/apache/gobblin/util/limiter/NoopLimiter.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi11dGlsaXR5L3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3V0aWwvbGltaXRlci9Ob29wTGltaXRlci5qYXZh)
 | `60% <0%> (+20%)` | `3% <0%> (+1%)` | :arrow_up: |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=footer).
 Last update 
[b92f516...cf51242](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   
 

This is an automated message from the 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

2019-10-17 Thread ASF GitHub Bot (Jira)


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

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

Author: ASF GitHub Bot
Created on: 18/Oct/19 00:55
Start Date: 18/Oct/19 00:55
Worklog Time Spent: 10m 
  Work Description: vikrambohra commented on issue #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: 
https://github.com/apache/incubator-gobblin/pull/2765#issuecomment-543432337
 
 
   @sv2000 
 

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: 330219)
Time Spent: 1h 10m  (was: 1h)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 16/Oct/19 00:28
Start Date: 16/Oct/19 00:28
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r335233438
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,170 @@
+/*
+ * 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.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset reads files with format /path/to/dir/".*([0-9]{13})-PT-.*"*
+ * where the regex can be supplied through configuration.
+ * It extracts the timestamp from the path and filters paths which lie within 
the {@link #lookbackPeriod}
+ * It then applies the {@link #snapshotSelectionPolicy} to filter further.
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEEX = ".*([0-9]{13})-PT-.*";
+  private final String lookbackTime;
+  private final Period lookbackPeriod;
+  private final LocalDateTime currentTime;
+  private final SnapshotSelectionPolicy snapshotSelectionPolicy;
+  private final DateTimeZone dateTimeZone;
+  private final Pattern timestampPattern;
+
+  public UnixTimestampRecursiveCopyableDataset(FileSystem fs, Path rootPath, 
Properties properties, Path glob) {
+super(fs, rootPath, properties, glob);
+this.lookbackTime = 
properties.getProperty(TimeAwareRecursiveCopyableDataset.LOOKBACK_TIME_KEY);
+this.snapshotSelectionPolicy =
+
SnapshotSelectionPolicy.valueOf(properties.getProperty(SNAPSHOT_SELECTION_POLICY).toUpperCase());
+PeriodFormatter periodFormatter = new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").toFormatter();
+this.lookbackPeriod = periodFormatter.parsePeriod(lookbackTime);
+String timestampRegex = properties.getProperty(TIMESTAMP_REGEEX, 
DEFAULT_TIMESTAMP_REGEEX);
+this.timestampPattern = Pattern.compile(timestampRegex);
+this.dateTimeZone = DateTimeZone.forID(properties
+
.getProperty(TimeAwareRecursiveCopyableDataset.DATE_PATTERN_TIMEZONE_KEY,
+TimeAwareRecursiveCopyableDataset.DEFAULT_DATE_PATTERN_TIMEZONE));
+this.currentTime = LocalDateTime.now(this.dateTimeZone);
+  }
+
+  private enum SnapshotSelectionPolicy {
+EARLIEST, LATEST, ALL
+  }
+
+  class TimestampPathFilter implements PathFilter {
+
+@Override
+public boolean accept(Path path) {
+
+  LocalDate endDate = currentTime.toLocalDate();
+  LocalDate startDate = endDate.minus(lookbackPeriod);
+  Matcher matcher = timestampPattern.matcher(path.toString());
+  if (!matcher.matches()) {
+return false;
+  }
+  Long timestamp = Long.parseLong(matcher.group(1));
+  LocalDate dateOfTimestamp = new 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 16/Oct/19 00:28
Start Date: 16/Oct/19 00:28
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r335230619
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,170 @@
+/*
+ * 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.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset reads files with format /path/to/dir/".*([0-9]{13})-PT-.*"*
+ * where the regex can be supplied through configuration.
+ * It extracts the timestamp from the path and filters paths which lie within 
the {@link #lookbackPeriod}
+ * It then applies the {@link #snapshotSelectionPolicy} to filter further.
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEEX = ".*([0-9]{13})-PT-.*";
 
 Review comment:
   Shouldn't the regex be derived based on config for gobblin.dataset.pattern? 
IN other words, we should be looking for timestamp after the dataset root.
 

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: 328879)
Time Spent: 1h  (was: 50m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 16/Oct/19 00:28
Start Date: 16/Oct/19 00:28
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r335232277
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,170 @@
+/*
+ * 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.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset reads files with format /path/to/dir/".*([0-9]{13})-PT-.*"*
+ * where the regex can be supplied through configuration.
+ * It extracts the timestamp from the path and filters paths which lie within 
the {@link #lookbackPeriod}
+ * It then applies the {@link #snapshotSelectionPolicy} to filter further.
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEEX = ".*([0-9]{13})-PT-.*";
+  private final String lookbackTime;
+  private final Period lookbackPeriod;
+  private final LocalDateTime currentTime;
+  private final SnapshotSelectionPolicy snapshotSelectionPolicy;
+  private final DateTimeZone dateTimeZone;
+  private final Pattern timestampPattern;
+
+  public UnixTimestampRecursiveCopyableDataset(FileSystem fs, Path rootPath, 
Properties properties, Path glob) {
+super(fs, rootPath, properties, glob);
+this.lookbackTime = 
properties.getProperty(TimeAwareRecursiveCopyableDataset.LOOKBACK_TIME_KEY);
+this.snapshotSelectionPolicy =
+
SnapshotSelectionPolicy.valueOf(properties.getProperty(SNAPSHOT_SELECTION_POLICY).toUpperCase());
+PeriodFormatter periodFormatter = new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").toFormatter();
+this.lookbackPeriod = periodFormatter.parsePeriod(lookbackTime);
+String timestampRegex = properties.getProperty(TIMESTAMP_REGEEX, 
DEFAULT_TIMESTAMP_REGEEX);
+this.timestampPattern = Pattern.compile(timestampRegex);
+this.dateTimeZone = DateTimeZone.forID(properties
+
.getProperty(TimeAwareRecursiveCopyableDataset.DATE_PATTERN_TIMEZONE_KEY,
+TimeAwareRecursiveCopyableDataset.DEFAULT_DATE_PATTERN_TIMEZONE));
+this.currentTime = LocalDateTime.now(this.dateTimeZone);
+  }
+
+  private enum SnapshotSelectionPolicy {
+EARLIEST, LATEST, ALL
+  }
+
+  class TimestampPathFilter implements PathFilter {
+
+@Override
+public boolean accept(Path path) {
+
+  LocalDate endDate = currentTime.toLocalDate();
+  LocalDate startDate = endDate.minus(lookbackPeriod);
+  Matcher matcher = timestampPattern.matcher(path.toString());
+  if (!matcher.matches()) {
+return false;
+  }
+  Long timestamp = Long.parseLong(matcher.group(1));
+  LocalDate dateOfTimestamp = new 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 16/Oct/19 00:28
Start Date: 16/Oct/19 00:28
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r335230521
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,170 @@
+/*
+ * 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.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset reads files with format /path/to/dir/".*([0-9]{13})-PT-.*"*
+ * where the regex can be supplied through configuration.
+ * It extracts the timestamp from the path and filters paths which lie within 
the {@link #lookbackPeriod}
+ * It then applies the {@link #snapshotSelectionPolicy} to filter further.
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEEX = ".*([0-9]{13})-PT-.*";
 
 Review comment:
   typo: DEFAULT_TIMESTAMP_REGEX?
 

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: 328876)
Time Spent: 50m  (was: 40m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 16/Oct/19 00:28
Start Date: 16/Oct/19 00:28
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on pull request #2765: [GOBBLIN-910] 
Added a unix timestamp recursive copyable dataset finder
URL: https://github.com/apache/incubator-gobblin/pull/2765#discussion_r335233779
 
 

 ##
 File path: 
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/UnixTimestampRecursiveCopyableDataset.java
 ##
 @@ -0,0 +1,170 @@
+/*
+ * 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.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.PathFilter;
+import org.joda.time.DateTimeZone;
+import org.joda.time.LocalDate;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Period;
+import org.joda.time.format.PeriodFormatter;
+import org.joda.time.format.PeriodFormatterBuilder;
+import org.testng.collections.Lists;
+
+import org.apache.gobblin.util.filters.AndPathFilter;
+
+
+/**
+ * This dataset reads files with format /path/to/dir/".*([0-9]{13})-PT-.*"*
+ * where the regex can be supplied through configuration.
+ * It extracts the timestamp from the path and filters paths which lie within 
the {@link #lookbackPeriod}
+ * It then applies the {@link #snapshotSelectionPolicy} to filter further.
+ */
+public class UnixTimestampRecursiveCopyableDataset extends 
RecursiveCopyableDataset {
+
+  private static final String CONFIG_PREFIX = CopyConfiguration.COPY_PREFIX + 
".recursive";
+  public static final String SNAPSHOT_SELECTION_POLICY = CONFIG_PREFIX + 
".snapshot.selection.policy";
+  public static final String TIMESTAMP_REGEEX = CONFIG_PREFIX + 
".timestamp.pattern";
+  public static final String DEFAULT_TIMESTAMP_REGEEX = ".*([0-9]{13})-PT-.*";
+  private final String lookbackTime;
+  private final Period lookbackPeriod;
+  private final LocalDateTime currentTime;
+  private final SnapshotSelectionPolicy snapshotSelectionPolicy;
+  private final DateTimeZone dateTimeZone;
+  private final Pattern timestampPattern;
+
+  public UnixTimestampRecursiveCopyableDataset(FileSystem fs, Path rootPath, 
Properties properties, Path glob) {
+super(fs, rootPath, properties, glob);
+this.lookbackTime = 
properties.getProperty(TimeAwareRecursiveCopyableDataset.LOOKBACK_TIME_KEY);
+this.snapshotSelectionPolicy =
+
SnapshotSelectionPolicy.valueOf(properties.getProperty(SNAPSHOT_SELECTION_POLICY).toUpperCase());
+PeriodFormatter periodFormatter = new 
PeriodFormatterBuilder().appendDays().appendSuffix("d").toFormatter();
+this.lookbackPeriod = periodFormatter.parsePeriod(lookbackTime);
+String timestampRegex = properties.getProperty(TIMESTAMP_REGEEX, 
DEFAULT_TIMESTAMP_REGEEX);
+this.timestampPattern = Pattern.compile(timestampRegex);
+this.dateTimeZone = DateTimeZone.forID(properties
+
.getProperty(TimeAwareRecursiveCopyableDataset.DATE_PATTERN_TIMEZONE_KEY,
+TimeAwareRecursiveCopyableDataset.DEFAULT_DATE_PATTERN_TIMEZONE));
+this.currentTime = LocalDateTime.now(this.dateTimeZone);
+  }
+
+  private enum SnapshotSelectionPolicy {
+EARLIEST, LATEST, ALL
+  }
+
+  class TimestampPathFilter implements PathFilter {
+
+@Override
+public boolean accept(Path path) {
+
+  LocalDate endDate = currentTime.toLocalDate();
+  LocalDate startDate = endDate.minus(lookbackPeriod);
+  Matcher matcher = timestampPattern.matcher(path.toString());
+  if (!matcher.matches()) {
+return false;
+  }
+  Long timestamp = Long.parseLong(matcher.group(1));
+  LocalDate dateOfTimestamp = new 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 16/Oct/19 00:11
Start Date: 16/Oct/19 00:11
Worklog Time Spent: 10m 
  Work Description: sv2000 commented on issue #2765: [GOBBLIN-910] 
URL: 
https://github.com/apache/incubator-gobblin/pull/2765#issuecomment-542455333
 
 
   The PR is missing a title. @vikrambohra 
 

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: 328870)
Time Spent: 40m  (was: 0.5h)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 16/Oct/19 00:07
Start Date: 16/Oct/19 00:07
Worklog Time Spent: 10m 
  Work Description: codecov-io commented on issue #2765: [GOBBLIN-910] 
URL: 
https://github.com/apache/incubator-gobblin/pull/2765#issuecomment-542454409
 
 
   # 
[Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=h1)
 Report
   > Merging 
[#2765](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=desc)
 into 
[master](https://codecov.io/gh/apache/incubator-gobblin/commit/bce5cbc3c8bb607b8c1af56dd3b41f75bbb2b92e?src=pr=desc)
 will **increase** coverage by `0.03%`.
   > The diff coverage is `80.28%`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/graphs/tree.svg?width=650=4MgURJ0bGc=150=pr)](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=tree)
   
   ```diff
   @@ Coverage Diff  @@
   ## master#2765  +/-   ##
   
   + Coverage  45.3%   45.33%   +0.03% 
   - Complexity 8841 8851  +10 
   
 Files  1890 1892   +2 
 Lines 7069870769  +71 
 Branches   7766 7781  +15 
   
   + Hits  3202832083  +55 
   - Misses3571835727   +9 
   - Partials   2952 2959   +7
   ```
   
   
   | [Impacted 
Files](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=tree) 
| Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | 
[...ement/copy/UnixTimestampCopyableDatasetFinder.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvVW5peFRpbWVzdGFtcENvcHlhYmxlRGF0YXNldEZpbmRlci5qYXZh)
 | `0% <0%> (ø)` | `0 <0> (?)` | |
   | 
[...nt/copy/UnixTimestampRecursiveCopyableDataset.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1kYXRhLW1hbmFnZW1lbnQvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vZGF0YS9tYW5hZ2VtZW50L2NvcHkvVW5peFRpbWVzdGFtcFJlY3Vyc2l2ZUNvcHlhYmxlRGF0YXNldC5qYXZh)
 | `83.82% <83.82%> (ø)` | `11 <11> (?)` | |
   | 
[...he/gobblin/writer/FineGrainedWatermarkTracker.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1jb3JlLWJhc2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vd3JpdGVyL0ZpbmVHcmFpbmVkV2F0ZXJtYXJrVHJhY2tlci5qYXZh)
 | `82.25% <0%> (-2.42%)` | `28% <0%> (-1%)` | |
   | 
[.../apache/gobblin/runtime/api/JobExecutionState.java](https://codecov.io/gh/apache/incubator-gobblin/pull/2765/diff?src=pr=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL0pvYkV4ZWN1dGlvblN0YXRlLmphdmE=)
 | `80.37% <0%> (+0.93%)` | `24% <0%> (ø)` | :arrow_down: |
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=footer).
 Last update 
[bce5cbc...b6f864c](https://codecov.io/gh/apache/incubator-gobblin/pull/2765?src=pr=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   
 

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: 328867)
Time Spent: 0.5h  (was: 20m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> 

[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 15/Oct/19 23:33
Start Date: 15/Oct/19 23:33
Worklog Time Spent: 10m 
  Work Description: vikrambohra commented on pull request #2765: 
[GOBBLIN-910] 
URL: https://github.com/apache/incubator-gobblin/pull/2765
 
 
   Dear Gobblin maintainers,
   
   Please accept this PR. I understand that it will not be reviewed until I 
have checked off all the steps below!
   
   
   ### JIRA
   - [ x] My PR addresses the following 
[Gobblin-910](https://issues.apache.org/jira/browse/GOBBLIN/) issues and 
references them in the PR title. For example, "[GOBBLIN-910] My Gobblin PR"
   - https://issues.apache.org/jira/browse/GOBBLIN-910
   
   
   ### Description
   - [ x] Here are some details about my PR, including screenshots (if 
applicable):
   - Added a unix timestamp recursive copyable dataset finder
   - a snapshot selection policy
   - lookback time
   
   ### Tests
   - [x ] My PR adds the following unit tests __OR__ does not need testing for 
this extremely good reason:
   - UnixTimestampRecursiveCopyableDatasetTest
   - Ran tests on sample datasets on hadoop
   
   ### Commits
   - [x ] My commits all reference JIRA issues in their subject lines, and I 
have squashed multiple commits if they address the same issue. In addition, my 
commits follow the guidelines from "[How to write a good git commit 
message](http://chris.beams.io/posts/git-commit/)":
   1. Subject is separated from body by a blank line
   2. Subject is limited to 50 characters
   3. Subject does not end with a period
   4. Subject uses the imperative mood ("add", not "adding")
   5. Body wraps at 72 characters
   6. Body explains "what" and "why", not "how"
   
   
 

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: 328847)
Remaining Estimate: 0h
Time Spent: 10m

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (GOBBLIN-910) Add Unix timestamp copyable recursive dataset finder with snapshot selection policy

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


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

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

Author: ASF GitHub Bot
Created on: 15/Oct/19 23:33
Start Date: 15/Oct/19 23:33
Worklog Time Spent: 10m 
  Work Description: vikrambohra commented on issue #2765: [GOBBLIN-910] 
URL: 
https://github.com/apache/incubator-gobblin/pull/2765#issuecomment-542447192
 
 
   @sv2000 
 

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: 328848)
Time Spent: 20m  (was: 10m)

> Add Unix timestamp copyable recursive dataset finder with snapshot selection 
> policy
> ---
>
> Key: GOBBLIN-910
> URL: https://issues.apache.org/jira/browse/GOBBLIN-910
> Project: Apache Gobblin
>  Issue Type: New Feature
>Reporter: Vikram Bohra
>Priority: Major
>  Time Spent: 20m
>  Remaining Estimate: 0h
>
> A dataset finder that takes a lookback time and a snapshot selection p[olicy 
> to return a list of files to copy from source to destination. 
> The finder also takes in a regex that is used to extract the timestamp from 
> the path.
> snapshot policies 
> ALL: Returns all files within the look back time 
> EARLIEST: returns the earliest snapshot per day of the look back time
> LATEST: returns the last snapshot per day of the look back time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)