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

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

                Author: ASF GitHub Bot
            Created on: 18/Mar/20 01:13
            Start Date: 18/Mar/20 01:13
    Worklog Time Spent: 10m 
      Work Description: sv2000 commented on pull request #2919: [GOBBLIN-1078] 
Coordination between task cancel and initialization in Helix Task
URL: https://github.com/apache/incubator-gobblin/pull/2919#discussion_r394054690
 
 

 ##########
 File path: 
gobblin-cluster/src/main/java/org/apache/gobblin/cluster/SingleTask.java
 ##########
 @@ -93,8 +109,17 @@ public void run()
         .createDefaultTopLevelBroker(jobConfig, 
GobblinScopeTypes.GLOBAL.defaultScopeInstance())) {
       SharedResourcesBroker<GobblinScopeTypes> jobBroker = 
getJobBroker(_jobState, globalBroker);
 
-      _taskAttempt = _taskAttemptBuilder.build(workUnits.iterator(), _jobId, 
_jobState, jobBroker);
-      
_taskAttempt.runAndOptionallyCommitTaskAttempt(GobblinMultiTaskAttempt.CommitPolicy.IMMEDIATE);
+      // Secure atomicity of taskAttempt's execution.
+      // Signaling blocking threads if any whenever taskAttempt is nonNull.
+      _taskAttempt = _taskAttemptBuilder.build(getWorkUnits().iterator(), 
_jobId, _jobState, jobBroker);
+
+      _lock.lock();
+      try {
+        _taskAttemptBuilt.signal();
+        
_taskAttempt.runAndOptionallyCommitTaskAttempt(GobblinMultiTaskAttempt.CommitPolicy.IMMEDIATE);
 
 Review comment:
   Maybe I am missing something obvious - won't this block until the 
taskAttempt is finished? If so, is it right to hold the lock() until the 
attempt is finished? For instance, if a cancel() is invoked, won't the cancel() 
be waiting forever for the lock()? Alternately, if the cancel() acquires the 
lock() before the taskAttempt is built, then taskAttempt may be created after 
the cancel() fails.
 
----------------------------------------------------------------
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:
[email protected]


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

    Worklog Id:     (was: 405093)
    Time Spent: 2h  (was: 1h 50m)

> Coordination between task cancel and task initialization in Helix
> -----------------------------------------------------------------
>
>                 Key: GOBBLIN-1078
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1078
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Lei Sun
>            Priority: Major
>          Time Spent: 2h
>  Remaining Estimate: 0h
>




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

Reply via email to