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

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

                Author: ASF GitHub Bot
            Created on: 05/Mar/20 17:24
            Start Date: 05/Mar/20 17:24
    Worklog Time Spent: 10m 
      Work Description: sv2000 commented on pull request #2909: [GOBBLIN-1071] 
Retry task initialization
URL: https://github.com/apache/incubator-gobblin/pull/2909#discussion_r388437144
 
 

 ##########
 File path: 
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTask.java
 ##########
 @@ -50,49 +54,74 @@
 public class SingleTask {
 
   private static final Logger _logger = 
LoggerFactory.getLogger(SingleTask.class);
+  public static final String MAX_RETRY_WAITING_FOR_INIT_KEY = 
"maxRetryBlockedOnTaskAttemptInit";
+  public static final int DEFAULT_MAX_RETRY_WAITING_FOR_INIT = 2;
 
-  private GobblinMultiTaskAttempt _taskattempt;
+  private GobblinMultiTaskAttempt _taskAttempt;
   private String _jobId;
   private Path _workUnitFilePath;
   private Path _jobStateFilePath;
   private FileSystem _fs;
   private TaskAttemptBuilder _taskAttemptBuilder;
   private StateStores _stateStores;
   private Config _dynamicConfig;
+  private List<WorkUnit> _workUnits;
+  private JobState _jobState;
 
+  // Preventing Helix calling cancel before taskAttempt is created
+  // Checking if taskAttempt is empty is not enough, since canceller runs in 
different thread as runner, the case to
+  // to avoided here is taskAttempt being created and start to run after 
cancel has been called.
+  private Condition _taskAttemptBuilt;
+  private Lock _lock;
+
+  /**
+   * Do all heavy-lifting of initialization in constructor which could be 
retried if failed,
+   * see the example in {@link GobblinHelixTask}.
+   */
   SingleTask(String jobId, Path workUnitFilePath, Path jobStateFilePath, 
FileSystem fs,
-      TaskAttemptBuilder taskAttemptBuilder, StateStores stateStores, Config 
dynamicConfig) {
+      TaskAttemptBuilder taskAttemptBuilder, StateStores stateStores, Config 
dynamicConfig) throws IOException {
     _jobId = jobId;
     _workUnitFilePath = workUnitFilePath;
     _jobStateFilePath = jobStateFilePath;
     _fs = fs;
     _taskAttemptBuilder = taskAttemptBuilder;
     _stateStores = stateStores;
     _dynamicConfig = dynamicConfig;
+
+    _workUnits = getWorkUnits();
 
 Review comment:
   Why do we have to eagerly initialize workunits?
 
----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 398531)
    Time Spent: 50m  (was: 40m)

> Retry Task Initialization
> -------------------------
>
>                 Key: GOBBLIN-1071
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1071
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Lei Sun
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to