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/11/16 22:47:08 UTC

[GitHub] [incubator-gobblin] arjun4084346 opened a new pull request #3155: fix cancellation in gobblin cluster jobs

arjun4084346 opened a new pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155


   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 #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,42 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> distributedJobMode;
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    this.jobSchedulerMetrics.numCancellationStart.incrementAndGet();
+
+    try {
+      distributedJobMode = this.jobsMapping.getDistributedJobMode(jobUri);
+      if (distributedJobMode.isPresent() && Boolean.parseBoolean(distributedJobMode.get())) {
+        planningJob = this.jobsMapping.getPlanningJobId(jobUri);
+      } else {
+        actualJob = this.jobsMapping.getActualJobId(jobUri);
+      }
+    } catch (IOException e) {
+      LOGGER.warn("jobsMapping could not be retrieved for job {}", jobUri);
+      return;
+    }
+
+    if (planningJob.isPresent()) {
+      LOGGER.info("Cancelling planning job helix workflow: {}", planningJob.get());
+      new TaskDriver(this.taskDriverHelixManager.get()).waitToStop(planningJob.get(), this.helixJobStopTimeoutMillis);

Review comment:
       According to the javadoc, if this method does not throw any exception, the cancellation is successful. 




----------------------------------------------------------------
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] codecov-io edited a comment on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (ff9f0aa) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/f81a2a2ac93091ac878985565bc010532418e2c2?el=desc) (f81a2a2) will **decrease** coverage by `36.70%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #3155       +/-   ##
   ============================================
   - Coverage     45.93%   9.22%   -36.71%     
   + Complexity     9596    1726     -7870     
   ============================================
     Files          1997    1998        +1     
     Lines         76096   76181       +85     
     Branches       8469    8478        +9     
   ============================================
   - Hits          34952    7027    -27925     
   - Misses        37879   68470    +30591     
   + Partials       3265     684     -2581     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...che/gobblin/cluster/FsJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvRnNKb2JDb25maWd1cmF0aW9uTWFuYWdlci5qYXZh) | `0.00% <0.00%> (-74.42%)` | `0.00 <0.00> (-7.00)` | |
   | [...va/org/apache/gobblin/cluster/GobblinHelixJob.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `15.51% <0.00%> (-23.70%)` | `2.00 <0.00> (-4.00)` | |
   | [...rg/apache/gobblin/cluster/GobblinHelixJobTask.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iVGFzay5qYXZh) | `4.44% <0.00%> (-55.56%)` | `0.00 <0.00> (-6.00)` | |
   | [...a/org/apache/gobblin/cluster/HelixJobsMapping.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhKb2JzTWFwcGluZy5qYXZh) | `22.95% <0.00%> (-66.64%)` | `1.00 <0.00> (-12.00)` | |
   | [.../gobblin/cluster/HelixRetriggeringJobCallable.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhSZXRyaWdnZXJpbmdKb2JDYWxsYWJsZS5qYXZh) | `0.00% <0.00%> (-60.42%)` | `0.00 <0.00> (-9.00)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `65.11% <0.00%> (-22.39%)` | `7.00 <0.00> (-3.00)` | |
   | [...blin/cluster/ScheduledJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2NoZWR1bGVkSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [1063 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [f81a2a2...ff9f0aa](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] arjun4084346 commented on a change in pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/HelixRetriggeringJobCallable.java
##########
@@ -334,15 +351,44 @@ private void runJobExecutionLauncher() throws JobException {
       if (startTime != 0) {
         this.planningJobLauncherMetrics.updateTimeForFailedPlanningJobs(startTime);
       }
-      log.error("Failed to run planning job {}", jobName, e);
-      throw new JobException("Failed to run planning job " + jobName, e);
+      log.error("Failed to run planning job for {}", this.jobUri, e);
+      throw new JobException("Failed to run planning job for " + this.jobUri, e);
     } finally {
       try {
         closer.close();
       } catch (IOException e) {
-        throw new JobException("Cannot properly close planning job " + jobName, e);
+        throw new JobException("Cannot properly close planning job for " + this.jobUri, e);
+      }
+    }
+  }
+
+  private boolean canRun(Optional<String> jobIdFromStore, HelixManager helixManager) throws JobException, InterruptedException {

Review comment:
       I just refactored this code to avoid code duplication




----------------------------------------------------------------
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 #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,42 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> distributedJobMode;
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    this.jobSchedulerMetrics.numCancellationStart.incrementAndGet();
+
+    try {
+      distributedJobMode = this.jobsMapping.getDistributedJobMode(jobUri);
+      if (distributedJobMode.isPresent() && Boolean.parseBoolean(distributedJobMode.get())) {
+        planningJob = this.jobsMapping.getPlanningJobId(jobUri);
+      } else {
+        actualJob = this.jobsMapping.getActualJobId(jobUri);
+      }
+    } catch (IOException e) {
+      LOGGER.warn("jobsMapping could not be retrieved for job {}", jobUri);
+      return;
+    }
+
+    if (planningJob.isPresent()) {
+      LOGGER.info("Cancelling planning job helix workflow: {}", planningJob.get());
+      new TaskDriver(this.taskDriverHelixManager.get()).waitToStop(planningJob.get(), this.helixJobStopTimeoutMillis);

Review comment:
       And also, there will be plenty of helix logs, cluster-worker and/or cluster-taskdriver logs to confirm the cancellation




----------------------------------------------------------------
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 #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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


   


----------------------------------------------------------------
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 #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,33 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    try {
+      planningJob = this.jobsMapping.getPlanningJobId(jobUri);
+      actualJob = this.jobsMapping.getActualJobId(jobUri);
+    } catch (IOException e) {
+      LOGGER.warn("Planning and actual jobs could not be retrieved for job {}", jobUri);
+      return;
+    }
+
+    if (planningJob.isPresent()) {
+      LOGGER.info("Cancelling planning job helix workflow: {}", planningJob.get());
+      new TaskDriver(this.taskDriverHelixManager.get()).waitToStop(planningJob.get(), this.helixJobStopTimeoutMillis);
+    }
+
+    if (actualJob.isPresent()) {
+      LOGGER.info("Cancelling actual job helix workflow: {}", actualJob.get());
+      new TaskDriver(this.jobHelixManager).waitToStop(actualJob.get(), this.helixJobStopTimeoutMillis);
+    }

Review comment:
       1) The problem is in `HelixUtils.getWorkflowIdsFromJobNames` method.
   It uses ConfigurationKeys.JOB_NAME_KEY (job.name) to identify helix workflows for the provided jobs. However, for planning jobs' `job.name` is the name of original jobs and not what you get with `planningJob.get()`
   The helix jobs' configs do have a field (`PLANNING_ID_KEY`) which stores `planningJob.get()` but I cannot use that field because I wanted to keep `cancelJobIfRequired()` method usable for rest of the helix jobs.
   
   2) There is no side effect, but yes it can be removed from here.
   
   3) HelixRetriggeringJobCallable.deleteJobSpec() calls `jobCatalog.remove()`, after it submits job to helix. I want this remove to be different than the DELETE request coming from GaaS, which is meant for cancellation (including deletion). added this comment in NonObservingFSJobCatalog




----------------------------------------------------------------
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] yukuai518 commented on a change in pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,33 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    try {
+      planningJob = this.jobsMapping.getPlanningJobId(jobUri);
+      actualJob = this.jobsMapping.getActualJobId(jobUri);
+    } catch (IOException e) {
+      LOGGER.warn("Planning and actual jobs could not be retrieved for job {}", jobUri);
+      return;
+    }
+
+    if (planningJob.isPresent()) {
+      LOGGER.info("Cancelling planning job helix workflow: {}", planningJob.get());
+      new TaskDriver(this.taskDriverHelixManager.get()).waitToStop(planningJob.get(), this.helixJobStopTimeoutMillis);
+    }
+
+    if (actualJob.isPresent()) {
+      LOGGER.info("Cancelling actual job helix workflow: {}", actualJob.get());
+      new TaskDriver(this.jobHelixManager).waitToStop(actualJob.get(), this.helixJobStopTimeoutMillis);
+    }

Review comment:
       I have several questions:
   1. What is the difference between this logic vs cancelJobIfRequired() method, can we reuse some part of the logic?
   2. I don't know if it is safe to stop the actual job twice. When you cancel the planningJob, the GobblinHelixJobLauncher on the task driver node will receive a cancellation message and invoke its own executeCancellation() method, which will further cancel the actual job on the worker node. If we cancel the actual job directly here, do we have any conflict? Will there be any race condition needs some scrutify?
   3. Can you provide some comments on which method will be used by GaaS and which one will be the opposite since you mentioned you want a separate path?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-gobblin] codecov-io edited a comment on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (ff9f0aa) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/f81a2a2ac93091ac878985565bc010532418e2c2?el=desc) (f81a2a2) will **decrease** coverage by `0.01%`.
   > The diff coverage is `34.64%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3155      +/-   ##
   ============================================
   - Coverage     45.93%   45.91%   -0.02%     
   - Complexity     9596     9605       +9     
   ============================================
     Files          1997     1998       +1     
     Lines         76096    76181      +85     
     Branches       8469     8478       +9     
   ============================================
   + Hits          34952    34977      +25     
   - Misses        37879    37939      +60     
     Partials       3265     3265              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...che/gobblin/cluster/FsJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvRnNKb2JDb25maWd1cmF0aW9uTWFuYWdlci5qYXZh) | `71.11% <0.00%> (-3.31%)` | `7.00 <0.00> (ø)` | |
   | [...va/org/apache/gobblin/cluster/GobblinHelixJob.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `34.48% <0.00%> (-4.74%)` | `6.00 <0.00> (ø)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `81.39% <0.00%> (-6.11%)` | `10.00 <0.00> (ø)` | |
   | [...blin/cluster/ScheduledJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2NoZWR1bGVkSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...lin/cluster/event/CancelJobConfigArrivalEvent.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvZXZlbnQvQ2FuY2VsSm9iQ29uZmlnQXJyaXZhbEV2ZW50LmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...apache/gobblin/runtime/api/JobCatalogListener.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL0pvYkNhdGFsb2dMaXN0ZW5lci5qYXZh) | `76.92% <0.00%> (-23.08%)` | `0.00 <0.00> (ø)` | |
   | [.../apache/gobblin/runtime/api/MutableJobCatalog.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL011dGFibGVKb2JDYXRhbG9nLmphdmE=) | `81.25% <0.00%> (-5.42%)` | `0.00 <0.00> (ø)` | |
   | ... and [13 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [f81a2a2...ff9f0aa](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] codecov-io edited a comment on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (e9f2368) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/7352cad8ae3a1d9be10d3b6fb78383ccbada9b19?el=desc) (7352cad) will **decrease** coverage by `32.47%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #3155       +/-   ##
   ============================================
   - Coverage     41.69%   9.22%   -32.48%     
   + Complexity     8743    1726     -7017     
   ============================================
     Files          1993    1998        +5     
     Lines         75990   76182      +192     
     Branches       8462    8479       +17     
   ============================================
   - Hits          31685    7027    -24658     
   - Misses        41297   68471    +27174     
   + Partials       3008     684     -2324     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...che/gobblin/cluster/FsJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvRnNKb2JDb25maWd1cmF0aW9uTWFuYWdlci5qYXZh) | `0.00% <0.00%> (-74.42%)` | `0.00 <0.00> (-7.00)` | |
   | [...va/org/apache/gobblin/cluster/GobblinHelixJob.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `15.51% <0.00%> (-23.70%)` | `2.00 <0.00> (-4.00)` | |
   | [...rg/apache/gobblin/cluster/GobblinHelixJobTask.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iVGFzay5qYXZh) | `4.44% <0.00%> (-55.56%)` | `0.00 <0.00> (-6.00)` | |
   | [...a/org/apache/gobblin/cluster/HelixJobsMapping.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhKb2JzTWFwcGluZy5qYXZh) | `22.95% <0.00%> (-66.64%)` | `1.00 <0.00> (-12.00)` | |
   | [.../gobblin/cluster/HelixRetriggeringJobCallable.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhSZXRyaWdnZXJpbmdKb2JDYWxsYWJsZS5qYXZh) | `0.00% <0.00%> (-60.42%)` | `0.00 <0.00> (-9.00)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `65.11% <0.00%> (-17.39%)` | `7.00 <0.00> (-3.00)` | |
   | [...blin/cluster/ScheduledJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2NoZWR1bGVkSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [1188 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [7352cad...e9f2368](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] codecov-io edited a comment on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (1dd8e7f) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/7352cad8ae3a1d9be10d3b6fb78383ccbada9b19?el=desc) (7352cad) will **increase** coverage by `4.21%`.
   > The diff coverage is `34.83%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3155      +/-   ##
   ============================================
   + Coverage     41.69%   45.91%   +4.21%     
   - Complexity     8743     9606     +863     
   ============================================
     Files          1993     1998       +5     
     Lines         75990    76183     +193     
     Branches       8462     8479      +17     
   ============================================
   + Hits          31685    34977    +3292     
   + Misses        41297    37938    -3359     
   - Partials       3008     3268     +260     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...che/gobblin/cluster/FsJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvRnNKb2JDb25maWd1cmF0aW9uTWFuYWdlci5qYXZh) | `71.11% <0.00%> (-3.31%)` | `7.00 <0.00> (ø)` | |
   | [...va/org/apache/gobblin/cluster/GobblinHelixJob.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `34.48% <0.00%> (-4.74%)` | `6.00 <0.00> (ø)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `81.39% <0.00%> (-1.11%)` | `10.00 <0.00> (ø)` | |
   | [...blin/cluster/ScheduledJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2NoZWR1bGVkSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...lin/cluster/event/CancelJobConfigArrivalEvent.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvZXZlbnQvQ2FuY2VsSm9iQ29uZmlnQXJyaXZhbEV2ZW50LmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...apache/gobblin/runtime/api/JobCatalogListener.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL0pvYkNhdGFsb2dMaXN0ZW5lci5qYXZh) | `76.92% <0.00%> (-23.08%)` | `0.00 <0.00> (ø)` | |
   | [.../apache/gobblin/runtime/api/MutableJobCatalog.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL011dGFibGVKb2JDYXRhbG9nLmphdmE=) | `81.25% <0.00%> (-5.42%)` | `0.00 <0.00> (ø)` | |
   | ... and [178 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [7352cad...e9f2368](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] arjun4084346 commented on a change in pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,33 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    try {
+      planningJob = this.jobsMapping.getPlanningJobId(jobUri);
+      actualJob = this.jobsMapping.getActualJobId(jobUri);
+    } catch (IOException e) {
+      LOGGER.warn("Planning and actual jobs could not be retrieved for job {}", jobUri);
+      return;
+    }
+
+    if (planningJob.isPresent()) {
+      LOGGER.info("Cancelling planning job helix workflow: {}", planningJob.get());
+      new TaskDriver(this.taskDriverHelixManager.get()).waitToStop(planningJob.get(), this.helixJobStopTimeoutMillis);
+    }
+
+    if (actualJob.isPresent()) {
+      LOGGER.info("Cancelling actual job helix workflow: {}", actualJob.get());
+      new TaskDriver(this.jobHelixManager).waitToStop(actualJob.get(), this.helixJobStopTimeoutMillis);
+    }

Review comment:
       1) The problem is in `HelixUtils.getWorkflowIdsFromJobNames` method.
   It uses ConfigurationKeys.JOB_NAME_KEY (job.name) to identify helix workflows for the provided jobs. However, for planning jobs `job.name` is the name of original jobs and not what you get with `planningJob.get()`
   The helix jobs' configs do have a field (`PLANNING_ID_KEY`) which stores `planningJob.get()` but I cannot use that field because I wanted to keep `cancelJobIfRequired()` method usable for rest of the helix jobs.
   
   2) There is no side effect, but yes it can be removed from here.
   
   3) HelixRetriggeringJobCallable.deleteJobSpec() calls `jobCatalog.remove()`, after it submits job to helix. I want this remove to be different than the DELETE request coming from GaaS, which is meant for cancellation (including deletion). added this comment in NonObservingFSJobCatalog




----------------------------------------------------------------
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] codecov-io edited a comment on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (45dc7ff) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/7352cad8ae3a1d9be10d3b6fb78383ccbada9b19?el=desc) (7352cad) will **decrease** coverage by `32.48%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #3155       +/-   ##
   ============================================
   - Coverage     41.69%   9.21%   -32.49%     
   + Complexity     8743    1724     -7019     
   ============================================
     Files          1993    1998        +5     
     Lines         75990   76182      +192     
     Branches       8462    8478       +16     
   ============================================
   - Hits          31685    7021    -24664     
   - Misses        41297   68477    +27180     
   + Partials       3008     684     -2324     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...che/gobblin/cluster/FsJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvRnNKb2JDb25maWd1cmF0aW9uTWFuYWdlci5qYXZh) | `0.00% <0.00%> (-74.42%)` | `0.00 <0.00> (-7.00)` | |
   | [...va/org/apache/gobblin/cluster/GobblinHelixJob.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `15.51% <0.00%> (-23.70%)` | `2.00 <0.00> (-4.00)` | |
   | [...rg/apache/gobblin/cluster/GobblinHelixJobTask.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iVGFzay5qYXZh) | `4.44% <0.00%> (-55.56%)` | `0.00 <0.00> (-6.00)` | |
   | [...a/org/apache/gobblin/cluster/HelixJobsMapping.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhKb2JzTWFwcGluZy5qYXZh) | `22.95% <0.00%> (-66.64%)` | `1.00 <0.00> (-12.00)` | |
   | [.../gobblin/cluster/HelixRetriggeringJobCallable.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhSZXRyaWdnZXJpbmdKb2JDYWxsYWJsZS5qYXZh) | `0.00% <0.00%> (-60.42%)` | `0.00 <0.00> (-9.00)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `65.11% <0.00%> (-17.39%)` | `7.00 <0.00> (-3.00)` | |
   | [...blin/cluster/ScheduledJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2NoZWR1bGVkSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [1188 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [7352cad...45dc7ff](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] codecov-io edited a comment on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (1dd8e7f) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/7352cad8ae3a1d9be10d3b6fb78383ccbada9b19?el=desc) (7352cad) will **decrease** coverage by `32.47%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #3155       +/-   ##
   ============================================
   - Coverage     41.69%   9.21%   -32.48%     
   + Complexity     8743    1724     -7019     
   ============================================
     Files          1993    1998        +5     
     Lines         75990   76183      +193     
     Branches       8462    8479       +17     
   ============================================
   - Hits          31685    7022    -24663     
   - Misses        41297   68478    +27181     
   + Partials       3008     683     -2325     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...che/gobblin/cluster/FsJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvRnNKb2JDb25maWd1cmF0aW9uTWFuYWdlci5qYXZh) | `0.00% <0.00%> (-74.42%)` | `0.00 <0.00> (-7.00)` | |
   | [...va/org/apache/gobblin/cluster/GobblinHelixJob.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `15.51% <0.00%> (-23.70%)` | `2.00 <0.00> (-4.00)` | |
   | [...rg/apache/gobblin/cluster/GobblinHelixJobTask.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iVGFzay5qYXZh) | `4.44% <0.00%> (-55.56%)` | `0.00 <0.00> (-6.00)` | |
   | [...a/org/apache/gobblin/cluster/HelixJobsMapping.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhKb2JzTWFwcGluZy5qYXZh) | `22.95% <0.00%> (-66.64%)` | `1.00 <0.00> (-12.00)` | |
   | [.../gobblin/cluster/HelixRetriggeringJobCallable.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSGVsaXhSZXRyaWdnZXJpbmdKb2JDYWxsYWJsZS5qYXZh) | `0.00% <0.00%> (-60.42%)` | `0.00 <0.00> (-9.00)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `65.11% <0.00%> (-17.39%)` | `7.00 <0.00> (-3.00)` | |
   | [...blin/cluster/ScheduledJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2NoZWR1bGVkSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | ... and [1188 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [7352cad...e9f2368](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] sv2000 commented on a change in pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,42 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> distributedJobMode;
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    this.jobSchedulerMetrics.numCancellationStart.incrementAndGet();
+
+    try {
+      distributedJobMode = this.jobsMapping.getDistributedJobMode(jobUri);
+      if (distributedJobMode.isPresent() && Boolean.parseBoolean(distributedJobMode.get())) {
+        planningJob = this.jobsMapping.getPlanningJobId(jobUri);
+      } else {
+        actualJob = this.jobsMapping.getActualJobId(jobUri);
+      }
+    } catch (IOException e) {
+      LOGGER.warn("jobsMapping could not be retrieved for job {}", jobUri);
+      return;
+    }
+
+    if (planningJob.isPresent()) {
+      LOGGER.info("Cancelling planning job helix workflow: {}", planningJob.get());
+      new TaskDriver(this.taskDriverHelixManager.get()).waitToStop(planningJob.get(), this.helixJobStopTimeoutMillis);

Review comment:
       We should log the outcome of the cancellation attempt. Was the job stopped successfully? If not, should the attempt be re-tried? 

##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,42 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> distributedJobMode;
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    this.jobSchedulerMetrics.numCancellationStart.incrementAndGet();
+
+    try {
+      distributedJobMode = this.jobsMapping.getDistributedJobMode(jobUri);
+      if (distributedJobMode.isPresent() && Boolean.parseBoolean(distributedJobMode.get())) {
+        planningJob = this.jobsMapping.getPlanningJobId(jobUri);
+      } else {
+        actualJob = this.jobsMapping.getActualJobId(jobUri);
+      }
+    } catch (IOException e) {
+      LOGGER.warn("jobsMapping could not be retrieved for job {}", jobUri);
+      return;
+    }
+
+    if (planningJob.isPresent()) {
+      LOGGER.info("Cancelling planning job helix workflow: {}", planningJob.get());
+      new TaskDriver(this.taskDriverHelixManager.get()).waitToStop(planningJob.get(), this.helixJobStopTimeoutMillis);
+    }
+
+    if (actualJob.isPresent()) {
+      LOGGER.info("Cancelling actual job helix workflow: {}", actualJob.get());
+      new TaskDriver(this.jobHelixManager).waitToStop(actualJob.get(), this.helixJobStopTimeoutMillis);

Review comment:
       Same comment as above.

##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/HelixRetriggeringJobCallable.java
##########
@@ -196,22 +202,57 @@ private void deleteJobSpec() throws JobException {
    * the job launcher determines it is safe to stop.
    */
   private void runJobLauncherLoop() throws JobException {
+    String actualJobId;
+    Lock jobLock = locks.get(this.jobUri);

Review comment:
       Why do we need a lock now when previously it was not needed? What has changed? Or is there a race condition you are trying to address? 

##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/HelixRetriggeringJobCallable.java
##########
@@ -334,15 +351,44 @@ private void runJobExecutionLauncher() throws JobException {
       if (startTime != 0) {
         this.planningJobLauncherMetrics.updateTimeForFailedPlanningJobs(startTime);
       }
-      log.error("Failed to run planning job {}", jobName, e);
-      throw new JobException("Failed to run planning job " + jobName, e);
+      log.error("Failed to run planning job for {}", this.jobUri, e);
+      throw new JobException("Failed to run planning job for " + this.jobUri, e);
     } finally {
       try {
         closer.close();
       } catch (IOException e) {
-        throw new JobException("Cannot properly close planning job " + jobName, e);
+        throw new JobException("Cannot properly close planning job for " + this.jobUri, e);
+      }
+    }
+  }
+
+  private boolean canRun(Optional<String> jobIdFromStore, HelixManager helixManager) throws JobException, InterruptedException {

Review comment:
       Can you document the behavior of canRun? Also, can this be unit tested?




----------------------------------------------------------------
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] codecov-io edited a comment on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (e9f2368) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/7352cad8ae3a1d9be10d3b6fb78383ccbada9b19?el=desc) (7352cad) will **increase** coverage by `4.21%`.
   > The diff coverage is `34.41%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3155      +/-   ##
   ============================================
   + Coverage     41.69%   45.91%   +4.21%     
   - Complexity     8743     9605     +862     
   ============================================
     Files          1993     1998       +5     
     Lines         75990    76182     +192     
     Branches       8462     8479      +17     
   ============================================
   + Hits          31685    34976    +3291     
   + Misses        41297    37938    -3359     
   - Partials       3008     3268     +260     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...che/gobblin/cluster/FsJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvRnNKb2JDb25maWd1cmF0aW9uTWFuYWdlci5qYXZh) | `71.11% <0.00%> (-3.31%)` | `7.00 <0.00> (ø)` | |
   | [...va/org/apache/gobblin/cluster/GobblinHelixJob.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `34.48% <0.00%> (-4.74%)` | `6.00 <0.00> (ø)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `81.39% <0.00%> (-1.11%)` | `10.00 <0.00> (ø)` | |
   | [...blin/cluster/ScheduledJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU2NoZWR1bGVkSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...lin/cluster/event/CancelJobConfigArrivalEvent.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvZXZlbnQvQ2FuY2VsSm9iQ29uZmlnQXJyaXZhbEV2ZW50LmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...apache/gobblin/runtime/api/JobCatalogListener.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL0pvYkNhdGFsb2dMaXN0ZW5lci5qYXZh) | `76.92% <0.00%> (-23.08%)` | `0.00 <0.00> (ø)` | |
   | [.../apache/gobblin/runtime/api/MutableJobCatalog.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL011dGFibGVKb2JDYXRhbG9nLmphdmE=) | `81.25% <0.00%> (-5.42%)` | `0.00 <0.00> (ø)` | |
   | ... and [177 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [7352cad...e9f2368](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] codecov-io commented on pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #3155:
URL: https://github.com/apache/incubator-gobblin/pull/3155#issuecomment-729282657


   # [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=h1) Report
   > Merging [#3155](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=desc) (d9d31d8) into [master](https://codecov.io/gh/apache/incubator-gobblin/commit/7352cad8ae3a1d9be10d3b6fb78383ccbada9b19?el=desc) (7352cad) will **decrease** coverage by `0.01%`.
   > The diff coverage is `26.31%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/graphs/tree.svg?width=650&height=150&src=pr&token=4MgURJ0bGc)](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3155      +/-   ##
   ============================================
   - Coverage     41.69%   41.68%   -0.02%     
   - Complexity     8743     8748       +5     
   ============================================
     Files          1993     1994       +1     
     Lines         75990    76033      +43     
     Branches       8462     8466       +4     
   ============================================
   + Hits          31685    31694       +9     
   - Misses        41297    41330      +33     
   - Partials       3008     3009       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [...a/org/apache/gobblin/runtime/api/SpecExecutor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1hcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2dvYmJsaW4vcnVudGltZS9hcGkvU3BlY0V4ZWN1dG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...ache/gobblin/cluster/GobblinHelixJobScheduler.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvR29iYmxpbkhlbGl4Sm9iU2NoZWR1bGVyLmphdmE=) | `35.29% <0.00%> (-3.93%)` | `6.00 <0.00> (ø)` | |
   | [...pache/gobblin/cluster/JobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `76.74% <0.00%> (-5.76%)` | `10.00 <0.00> (ø)` | |
   | [...blin/cluster/StreamingJobConfigurationManager.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvU3RyZWFtaW5nSm9iQ29uZmlndXJhdGlvbk1hbmFnZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [...lin/cluster/event/CancelJobConfigArrivalEvent.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1jbHVzdGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL2NsdXN0ZXIvZXZlbnQvQ2FuY2VsSm9iQ29uZmlnQXJyaXZhbEV2ZW50LmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (?)` | |
   | [...apache/gobblin/runtime/api/JobCatalogListener.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL0pvYkNhdGFsb2dMaXN0ZW5lci5qYXZh) | `76.92% <0.00%> (-23.08%)` | `0.00 <0.00> (ø)` | |
   | [.../apache/gobblin/runtime/api/MutableJobCatalog.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvYXBpL011dGFibGVKb2JDYXRhbG9nLmphdmE=) | `81.25% <0.00%> (-5.42%)` | `0.00 <0.00> (ø)` | |
   | [...n/runtime/job\_catalog/JobCatalogListenersList.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvam9iX2NhdGFsb2cvSm9iQ2F0YWxvZ0xpc3RlbmVyc0xpc3QuamF2YQ==) | `63.63% <0.00%> (-10.05%)` | `10.00 <0.00> (ø)` | |
   | [...e/gobblin/runtime/job\_monitor/KafkaJobMonitor.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvam9iX21vbml0b3IvS2Fma2FKb2JNb25pdG9yLmphdmE=) | `0.00% <0.00%> (ø)` | `0.00 <0.00> (ø)` | |
   | [.../runtime/job\_catalog/NonObservingFSJobCatalog.java](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree#diff-Z29iYmxpbi1ydW50aW1lL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9nb2JibGluL3J1bnRpbWUvam9iX2NhdGFsb2cvTm9uT2JzZXJ2aW5nRlNKb2JDYXRhbG9nLmphdmE=) | `55.81% <50.00%> (-1.69%)` | `6.00 <1.00> (+1.00)` | :arrow_down: |
   | ... and [7 more](https://codecov.io/gh/apache/incubator-gobblin/pull/3155/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=footer). Last update [7352cad...d9d31d8](https://codecov.io/gh/apache/incubator-gobblin/pull/3155?src=pr&el=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:
users@infra.apache.org



[GitHub] [incubator-gobblin] asfgit closed pull request #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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


   


----------------------------------------------------------------
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 #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,42 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> distributedJobMode;
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    this.jobSchedulerMetrics.numCancellationStart.incrementAndGet();
+
+    try {
+      distributedJobMode = this.jobsMapping.getDistributedJobMode(jobUri);
+      if (distributedJobMode.isPresent() && Boolean.parseBoolean(distributedJobMode.get())) {
+        planningJob = this.jobsMapping.getPlanningJobId(jobUri);

Review comment:
       In distributed mode, do we only have to cancel the planning job but not the actual job? Why is that?




----------------------------------------------------------------
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 #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobScheduler.java
##########
@@ -367,6 +369,42 @@ public void handleDeleteJobConfigArrival(DeleteJobConfigArrivalEvent deleteJobAr
     }
   }
 
+  @Subscribe
+  public void handleCancelJobConfigArrival(CancelJobConfigArrivalEvent cancelJobArrival)
+      throws InterruptedException {
+    String jobUri = cancelJobArrival.getJoburi();
+    LOGGER.info("Received cancel for job configuration of job " + jobUri);
+    Optional<String> distributedJobMode;
+    Optional<String> planningJob = Optional.empty();
+    Optional<String> actualJob = Optional.empty();
+
+    this.jobSchedulerMetrics.numCancellationStart.incrementAndGet();
+
+    try {
+      distributedJobMode = this.jobsMapping.getDistributedJobMode(jobUri);
+      if (distributedJobMode.isPresent() && Boolean.parseBoolean(distributedJobMode.get())) {
+        planningJob = this.jobsMapping.getPlanningJobId(jobUri);

Review comment:
       Yes, because the planning job cancellation method cancels the actual job.
   https://github.com/apache/incubator-gobblin/blob/master/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/GobblinHelixJobLauncher.java#L256




----------------------------------------------------------------
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 #3155: [GOBBLIN-1319] fix cancellation in gobblin cluster jobs

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



##########
File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/HelixRetriggeringJobCallable.java
##########
@@ -196,22 +202,57 @@ private void deleteJobSpec() throws JobException {
    * the job launcher determines it is safe to stop.
    */
   private void runJobLauncherLoop() throws JobException {
+    String actualJobId;
+    Lock jobLock = locks.get(this.jobUri);

Review comment:
       It is to avoid race condition in checking if the job with the same name is running. this is a new thing this method is doing.
   reference https://github.com/apache/incubator-gobblin/blob/master/gobblin-cluster/src/main/java/org/apache/gobblin/cluster/HelixRetriggeringJobCallable.java#L240




----------------------------------------------------------------
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