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/03/10 23:29:20 UTC

[GitHub] [incubator-gobblin] ZihanLi58 commented on a change in pull request #2919: [GOBBLIN-1078] Coordination between task cancel and initialization in Helix Task

ZihanLi58 commented on a change in pull request #2919: [GOBBLIN-1078] Coordination between task cancel and initialization in Helix Task
URL: https://github.com/apache/incubator-gobblin/pull/2919#discussion_r390667675
 
 

 ##########
 File path: gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTask.java
 ##########
 @@ -160,16 +181,32 @@ protected JobState getJobState()
   }
 
   public void cancel() {
-    if (_taskAttempt != null) {
+    int retryCount = 0 ;
+    int maxRetry = this._dynamicConfig.hasPath(MAX_RETRY_WAITING_FOR_INIT_KEY)
+        ? this._dynamicConfig.getInt(MAX_RETRY_WAITING_FOR_INIT_KEY) : DEFAULT_MAX_RETRY_WAITING_FOR_INIT;
+
+    try {
+      _lock.lock();
       try {
+        while (_taskAttempt == null) {
+          // await return false if timeout on this around
+          if (!_taskAttemptBuilt.await(5, TimeUnit.SECONDS) && ++retryCount > maxRetry) {
+            throw new IllegalStateException("Failed to initialize taskAttempt object before cancel");
 
 Review comment:
   Will this fail the job? Or we just want to log the error and ignore.

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


With regards,
Apache Git Services