You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Runping Qi (JIRA)" <ji...@apache.org> on 2007/10/25 22:55:50 UTC

[jira] Issue Comment Edited: (HADOOP-2086) ability to add dependencies to a job after construction

    [ https://issues.apache.org/jira/browse/HADOOP-2086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537706 ] 

runping edited comment on HADOOP-2086 at 10/25/07 1:54 PM:
--------------------------------------------------------------

I like 1).

Yes, there is a possibility of race condition when the JobControl may be also checking the state of the job. 
One solution is to make them synchronized:

{code}
synchronized public boolean addDependingJob(Job dependingJob) {
    if (this.state == Job.WAITING) { 
        //code to add depending job to list goes here 
    } else { 
        return false; 
    }
}

synchronized int checkState() {
 ...
}
{code}

Maybe it is also a good idea to make checkState() package private since it should not be called externally.





      was (Author: runping):
    
I like 1).

Yes, there is a possibility of race condition when the JobControl may be also checking the state of the job. 
One solution is to make them synchronized:

{code}
synchronized public boolean addDependingJob(Job dependingJob) {
    if (this.state == Job.WAITING) { 
        //code to add depending job to list goes here 
    } else { 
        return false; 
    }
}

synchronized int checkState() {
 ...
}
{/code}

Maybe it is also a good idea to make checkState() package private since it should not be called externally.




  
> ability to add dependencies to a job after construction
> -------------------------------------------------------
>
>                 Key: HADOOP-2086
>                 URL: https://issues.apache.org/jira/browse/HADOOP-2086
>             Project: Hadoop
>          Issue Type: Improvement
>          Components: mapred
>    Affects Versions: 0.14.2
>         Environment: n/a
>            Reporter: Adrian Woodhead
>             Fix For: 0.16.0
>
>         Attachments: job-add-dependencies.patch
>
>
> The current Job API only allows for dependent jobs to be passed in at object construction time. It would be nice if there was an additional constructor which did not take any depending jobs and then an "addDependingJob" method which could be used to add depending jobs to a job at a later point.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.