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/28 19:44:53 UTC
[GitHub] [incubator-gobblin] arjun4084346 opened a new pull request #3004: No spec delete on start2
arjun4084346 opened a new pull request #3004:
URL: https://github.com/apache/incubator-gobblin/pull/3004
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-XXX
### Description
- [ ] Here are some details about my PR, including screenshots (if applicable):
### Tests
- [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
### 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] arjun4084346 commented on a change in pull request #3004: No spec delete on start2
Posted by GitBox <gi...@apache.org>.
arjun4084346 commented on a change in pull request #3004:
URL: https://github.com/apache/incubator-gobblin/pull/3004#discussion_r432634755
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW))
+ .setTemplateUris(TEST_TEMPLATE_URI).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE).setRunImmediately(false))
+ .setProperties(new StringMap(flowProperties));
+ FlowSpec spec = FlowConfigResourceLocalHandler.createFlowSpecForConfig(flowConfig);
+
+ this.gobblinServiceManager.getFlowCatalog().getSpecStore().addSpec(spec);
+
+ serviceReboot();
+
+ List<Spec> specs = (List<Spec>) this.gobblinServiceManager.getFlowCatalog().getSpecs();
+ Assert.assertEquals(specs.size(), 1, "Flow that was created is not " + "reflecting in FlowCatalog");
+ Assert.assertEquals(specs.get(0).getUri(), spec.getUri());
+ Assert.assertFalse(flowConfig.getSchedule().isRunImmediately());
+
+ // clean it
+ this.gobblinServiceManager.getFlowCatalog().remove(spec.getUri());
+ }
+
+ @Test (dependsOnMethods = "testRestart")
+ public void testUncompilableJob() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowId flowId = new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW);
+ URI uri = FlowConfigResourceLocalHandler.FlowUriUtils.createFlowSpecUri(flowId);
+ FlowConfig flowConfig = new FlowConfig().setId(flowId)
+ .setTemplateUris(TEST_TEMPLATE_URI).setProperties(new StringMap(flowProperties));
+
+ RestLiResponseException exception = null;
+ try {
+ this.flowConfigClient.createFlowConfig(flowConfig);
+ } catch (RestLiResponseException e) {
+ exception = e;
+ }
+ Assert.assertEquals(exception.getStatus(), HttpStatus.BAD_REQUEST_400);
+ // uncompilable job should not be persisted
+ Assert.assertEquals(this.gobblinServiceManager.getFlowCatalog().getSpecs().size(), 0,
+ "Flow that was created is not " + "reflecting in FlowCatalog");
+ Assert.assertFalse(this.gobblinServiceManager.getScheduler().getScheduledFlowSpecs().containsKey(uri.toString()));
+ }
+
+ @Test (dependsOnMethods = "testUncompilableJob")
+ public void testRunOnceJob() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+
+ FlowConfig flowConfig = new FlowConfig().setId(TEST_FLOW_ID)
+ .setTemplateUris(TEST_TEMPLATE_URI).setProperties(new StringMap(flowProperties));
+
+ this.flowConfigClient.createFlowConfig(flowConfig);
+
+ // runOnce job should not be persisted
Review comment:
the runOnce job's existence is difficult to check because it can instantly be deleted. hence i am checking that it eventually get deleted.
----------------------------------------------------------------
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] arjun4084346 commented on a change in pull request #3004: No spec delete on start2
Posted by GitBox <gi...@apache.org>.
arjun4084346 commented on a change in pull request #3004:
URL: https://github.com/apache/incubator-gobblin/pull/3004#discussion_r432623352
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW))
Review comment:
the flow is not compilable, hence the name
----------------------------------------------------------------
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 #3004: No spec delete on start2
Posted by GitBox <gi...@apache.org>.
sv2000 commented on a change in pull request #3004:
URL: https://github.com/apache/incubator-gobblin/pull/3004#discussion_r432607850
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
Review comment:
Javadoc to explain what is the behavior being tested?
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW))
+ .setTemplateUris(TEST_TEMPLATE_URI).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE).setRunImmediately(false))
+ .setProperties(new StringMap(flowProperties));
+ FlowSpec spec = FlowConfigResourceLocalHandler.createFlowSpecForConfig(flowConfig);
+
+ this.gobblinServiceManager.getFlowCatalog().getSpecStore().addSpec(spec);
+
+ serviceReboot();
+
+ List<Spec> specs = (List<Spec>) this.gobblinServiceManager.getFlowCatalog().getSpecs();
+ Assert.assertEquals(specs.size(), 1, "Flow that was created is not " + "reflecting in FlowCatalog");
+ Assert.assertEquals(specs.get(0).getUri(), spec.getUri());
+ Assert.assertFalse(flowConfig.getSchedule().isRunImmediately());
+
+ // clean it
+ this.gobblinServiceManager.getFlowCatalog().remove(spec.getUri());
+ }
+
+ @Test (dependsOnMethods = "testRestart")
+ public void testUncompilableJob() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowId flowId = new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW);
+ URI uri = FlowConfigResourceLocalHandler.FlowUriUtils.createFlowSpecUri(flowId);
+ FlowConfig flowConfig = new FlowConfig().setId(flowId)
+ .setTemplateUris(TEST_TEMPLATE_URI).setProperties(new StringMap(flowProperties));
+
+ RestLiResponseException exception = null;
+ try {
+ this.flowConfigClient.createFlowConfig(flowConfig);
+ } catch (RestLiResponseException e) {
+ exception = e;
+ }
+ Assert.assertEquals(exception.getStatus(), HttpStatus.BAD_REQUEST_400);
+ // uncompilable job should not be persisted
+ Assert.assertEquals(this.gobblinServiceManager.getFlowCatalog().getSpecs().size(), 0,
+ "Flow that was created is not " + "reflecting in FlowCatalog");
+ Assert.assertFalse(this.gobblinServiceManager.getScheduler().getScheduledFlowSpecs().containsKey(uri.toString()));
+ }
+
+ @Test (dependsOnMethods = "testUncompilableJob")
+ public void testRunOnceJob() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+
+ FlowConfig flowConfig = new FlowConfig().setId(TEST_FLOW_ID)
+ .setTemplateUris(TEST_TEMPLATE_URI).setProperties(new StringMap(flowProperties));
+
+ this.flowConfigClient.createFlowConfig(flowConfig);
+
+ // runOnce job should not be persisted
Review comment:
Also, should we add a test that would remove the runOnce jobs on service restart?
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW))
+ .setTemplateUris(TEST_TEMPLATE_URI).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE).setRunImmediately(false))
+ .setProperties(new StringMap(flowProperties));
+ FlowSpec spec = FlowConfigResourceLocalHandler.createFlowSpecForConfig(flowConfig);
+
+ this.gobblinServiceManager.getFlowCatalog().getSpecStore().addSpec(spec);
+
Review comment:
Assertion here that the spec has been persisted in the spec store?
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW))
+ .setTemplateUris(TEST_TEMPLATE_URI).setSchedule(new Schedule().setCronSchedule(TEST_SCHEDULE).setRunImmediately(false))
+ .setProperties(new StringMap(flowProperties));
+ FlowSpec spec = FlowConfigResourceLocalHandler.createFlowSpecForConfig(flowConfig);
+
+ this.gobblinServiceManager.getFlowCatalog().getSpecStore().addSpec(spec);
+
+ serviceReboot();
+
+ List<Spec> specs = (List<Spec>) this.gobblinServiceManager.getFlowCatalog().getSpecs();
+ Assert.assertEquals(specs.size(), 1, "Flow that was created is not " + "reflecting in FlowCatalog");
+ Assert.assertEquals(specs.get(0).getUri(), spec.getUri());
+ Assert.assertFalse(flowConfig.getSchedule().isRunImmediately());
+
+ // clean it
+ this.gobblinServiceManager.getFlowCatalog().remove(spec.getUri());
+ }
+
+ @Test (dependsOnMethods = "testRestart")
+ public void testUncompilableJob() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowId flowId = new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW);
+ URI uri = FlowConfigResourceLocalHandler.FlowUriUtils.createFlowSpecUri(flowId);
+ FlowConfig flowConfig = new FlowConfig().setId(flowId)
+ .setTemplateUris(TEST_TEMPLATE_URI).setProperties(new StringMap(flowProperties));
+
+ RestLiResponseException exception = null;
+ try {
+ this.flowConfigClient.createFlowConfig(flowConfig);
+ } catch (RestLiResponseException e) {
+ exception = e;
+ }
+ Assert.assertEquals(exception.getStatus(), HttpStatus.BAD_REQUEST_400);
+ // uncompilable job should not be persisted
+ Assert.assertEquals(this.gobblinServiceManager.getFlowCatalog().getSpecs().size(), 0,
+ "Flow that was created is not " + "reflecting in FlowCatalog");
+ Assert.assertFalse(this.gobblinServiceManager.getScheduler().getScheduledFlowSpecs().containsKey(uri.toString()));
+ }
+
+ @Test (dependsOnMethods = "testUncompilableJob")
+ public void testRunOnceJob() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+
+ FlowConfig flowConfig = new FlowConfig().setId(TEST_FLOW_ID)
+ .setTemplateUris(TEST_TEMPLATE_URI).setProperties(new StringMap(flowProperties));
+
+ this.flowConfigClient.createFlowConfig(flowConfig);
+
+ // runOnce job should not be persisted
Review comment:
Shouldn't the runOnce job be persisted and deleted later by NonScheduledJobRunner?
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
Review comment:
Can we move the FlowSpec creation to a separate method? Might even be useful to move it a test utils class that can be reused across different Test classes.
##########
File path: gobblin-modules/gobblin-kafka-09/src/test/java/org/apache/gobblin/service/GobblinServiceManagerTest.java
##########
@@ -181,19 +192,107 @@ public void cleanUp() throws Exception {
}
@Test
- public void testCreate() throws Exception {
+ public void testRestart() throws Exception {
+ Map<String, String> flowProperties = Maps.newHashMap();
+ flowProperties.put("param1", "value1");
+ flowProperties.put(ServiceConfigKeys.FLOW_SOURCE_IDENTIFIER_KEY, TEST_SOURCE_NAME);
+ flowProperties.put(ServiceConfigKeys.FLOW_DESTINATION_IDENTIFIER_KEY, TEST_SINK_NAME);
+ FlowConfig flowConfig = new FlowConfig().setId(new FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(MockedSpecCompiler.UNCOMPILABLE_FLOW))
Review comment:
If this flow is Compiled correctly, then can we call this something other than a UNCOMPILABLE_FLOW, as that is confusing?
----------------------------------------------------------------
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] arjun4084346 closed pull request #3004: No spec delete on start2
Posted by GitBox <gi...@apache.org>.
arjun4084346 closed pull request #3004:
URL: https://github.com/apache/incubator-gobblin/pull/3004
----------------------------------------------------------------
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