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

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

                Author: ASF GitHub Bot
            Created on: 19/Mar/20 18:07
            Start Date: 19/Mar/20 18:07
    Worklog Time Spent: 10m 
      Work Description: ZihanLi58 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_r395222680
 
 

 ##########
 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:
   I was mistakenly thinking runAndOptionallyCommitTaskAttempt will return 
immediately. Then how about move this method out and make the build of 
taskAttemp inside the lock block?
 
----------------------------------------------------------------
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: 406455)
    Time Spent: 2.5h  (was: 2h 20m)

> 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: 2.5h
>  Remaining Estimate: 0h
>




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

Reply via email to