You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by GitBox <gi...@apache.org> on 2020/05/14 20:15:48 UTC

[GitHub] [incubator-gobblin] jack-moseley opened a new pull request #2987: [GOBBLIN-1149] Abstract out method for constructing descriptor from config

jack-moseley opened a new pull request #2987:
URL: https://github.com/apache/incubator-gobblin/pull/2987


   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 JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references them in the PR title. For example, "[GOBBLIN-XXX] My Gobblin PR"
       - https://issues.apache.org/jira/browse/GOBBLIN-1149
   
   
   ### Description
   - [ ] Here are some details about my PR, including screenshots (if applicable):
   
   Separate out method for constructing dataset descriptors from config so it can be reused in other places.
   
   ### Tests
   - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   
   trivial
   
   ### 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:
users@infra.apache.org



[GitHub] [incubator-gobblin] jack-moseley commented on pull request #2987: [GOBBLIN-1149] Abstract out method for constructing descriptor from config

Posted by GitBox <gi...@apache.org>.
jack-moseley commented on pull request #2987:
URL: https://github.com/apache/incubator-gobblin/pull/2987#issuecomment-628863945


   @sv2000 please review


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-gobblin] asfgit closed pull request #2987: [GOBBLIN-1149] Abstract out method for constructing descriptor from config

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #2987:
URL: https://github.com/apache/incubator-gobblin/pull/2987


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-gobblin] jack-moseley commented on a change in pull request #2987: [GOBBLIN-1149] Abstract out method for constructing descriptor from config

Posted by GitBox <gi...@apache.org>.
jack-moseley commented on a change in pull request #2987:
URL: https://github.com/apache/incubator-gobblin/pull/2987#discussion_r426882960



##########
File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/flowgraph/pathfinder/AbstractPathFinder.java
##########
@@ -150,15 +150,13 @@
       destDatasetDescriptorConfig = destDatasetDescriptorConfig.withFallback(getDefaultConfig(this.destNodes.get(0)));
     }
 
-    Class srcdatasetDescriptorClass =
-        Class.forName(srcDatasetDescriptorConfig.getString(DatasetDescriptorConfigKeys.CLASS_KEY));
-    this.srcDatasetDescriptor = (DatasetDescriptor) GobblinConstructorUtils
-        .invokeLongestConstructor(srcdatasetDescriptorClass, srcDatasetDescriptorConfig);
-    Class destDatasetDescriptorClass =
-        Class.forName(destDatasetDescriptorConfig.getString(DatasetDescriptorConfigKeys.CLASS_KEY));
-    this.destDatasetDescriptor = (DatasetDescriptor) GobblinConstructorUtils
-        .invokeLongestConstructor(destDatasetDescriptorClass, destDatasetDescriptorConfig);
+    this.srcDatasetDescriptor = constructDatasetDescriptor(srcDatasetDescriptorConfig);
+    this.destDatasetDescriptor = constructDatasetDescriptor(destDatasetDescriptorConfig);
+  }
 
+  public static DatasetDescriptor constructDatasetDescriptor(Config config) throws ReflectiveOperationException {

Review comment:
       Good point, didn't notice that. I moved it to a new util class.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #2987: [GOBBLIN-1149] Abstract out method for constructing descriptor from config

Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #2987:
URL: https://github.com/apache/incubator-gobblin/pull/2987#discussion_r425906720



##########
File path: gobblin-service/src/main/java/org/apache/gobblin/service/modules/flowgraph/pathfinder/AbstractPathFinder.java
##########
@@ -150,15 +150,13 @@
       destDatasetDescriptorConfig = destDatasetDescriptorConfig.withFallback(getDefaultConfig(this.destNodes.get(0)));
     }
 
-    Class srcdatasetDescriptorClass =
-        Class.forName(srcDatasetDescriptorConfig.getString(DatasetDescriptorConfigKeys.CLASS_KEY));
-    this.srcDatasetDescriptor = (DatasetDescriptor) GobblinConstructorUtils
-        .invokeLongestConstructor(srcdatasetDescriptorClass, srcDatasetDescriptorConfig);
-    Class destDatasetDescriptorClass =
-        Class.forName(destDatasetDescriptorConfig.getString(DatasetDescriptorConfigKeys.CLASS_KEY));
-    this.destDatasetDescriptor = (DatasetDescriptor) GobblinConstructorUtils
-        .invokeLongestConstructor(destDatasetDescriptorClass, destDatasetDescriptorConfig);
+    this.srcDatasetDescriptor = constructDatasetDescriptor(srcDatasetDescriptorConfig);
+    this.destDatasetDescriptor = constructDatasetDescriptor(destDatasetDescriptorConfig);
+  }
 
+  public static DatasetDescriptor constructDatasetDescriptor(Config config) throws ReflectiveOperationException {

Review comment:
       There is already a method getDatasetDescriptor() in StaticFlowTemplate class that does the exact same thing. Can we reuse that method? Also, do you think it might be better to move this method to a utility class?




----------------------------------------------------------------
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:
users@infra.apache.org