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

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

                Author: ASF GitHub Bot
            Created on: 27/Jun/23 05:30
            Start Date: 27/Jun/23 05:30
    Worklog Time Spent: 10m 
      Work Description: homatthew commented on code in PR #3711:
URL: https://github.com/apache/gobblin/pull/3711#discussion_r1243158430


##########
gobblin-cluster/src/test/java/org/apache/gobblin/cluster/GobblinHelixJobLauncherTest.java:
##########
@@ -299,6 +301,25 @@ public void testTimeout() throws Exception {
     Assert.assertThrows(JobException.class, () -> 
gobblinHelixJobLauncher.launchJobImpl(null));
   }
 
+  public void testExitCancelsJob() throws Exception {
+    final ConcurrentHashMap<String, Boolean> runningMap = new 
ConcurrentHashMap<>();
+
+    final Properties props = generateJobProperties(this.baseConfig, 
"testTimeoutTest", "_12345");
+    
props.setProperty(GobblinClusterConfigurationKeys.HELIX_WORKFLOW_SUBMISSION_TIMEOUT_SECONDS,
 "0");
+    
props.setProperty(GobblinClusterConfigurationKeys.HELIX_WORKFLOW_CANCEL_ON_EXIT,
 "true");
+
+    final GobblinHelixJobLauncher gobblinHelixJobLauncher = 
this.closer.register(
+        new GobblinHelixJobLauncher(props, this.helixManager, this.appWorkDir, 
ImmutableList.<Tag<?>>of(), runningMap,
+            java.util.Optional.empty()));
+
+    // The launchJob will throw an exception (see testTimeout test) and we 
expect the launcher to swallow the exception,
+    // then call still properly call cancel. We use the listener to confirm 
the cancel hook was correctly called once
+    JobListener mockListener = Mockito.mock(JobListener.class);
+    gobblinHelixJobLauncher.launchJob(mockListener);
+    
Mockito.verify(mockListener).onJobCancellation(Mockito.any(JobContext.class));

Review Comment:
   Fun fact: verify without a parameter verifies the method is called exactly 
once! 😃





Issue Time Tracking
-------------------

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

> HelixException from the Job manager in Fast Ingest should try to delete the 
> existing workflow
> ---------------------------------------------------------------------------------------------
>
>                 Key: GOBBLIN-1847
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1847
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Matthew Ho
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to