|
@@ -182,10 +182,18 @@ public class JobClient extends Configured implements MRConstants, Tool {
|
|
*/
|
|
*/
|
|
synchronized void ensureFreshStatus() throws IOException {
|
|
synchronized void ensureFreshStatus() throws IOException {
|
|
if (System.currentTimeMillis() - statustime > MAX_JOBPROFILE_AGE) {
|
|
if (System.currentTimeMillis() - statustime > MAX_JOBPROFILE_AGE) {
|
|
- this.status = jobSubmitClient.getJobStatus(profile.getJobID());
|
|
|
|
- this.statustime = System.currentTimeMillis();
|
|
|
|
|
|
+ updateStatus();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /** Some methods need to update status immediately. So, refresh
|
|
|
|
+ * immediately
|
|
|
|
+ * @throws IOException
|
|
|
|
+ */
|
|
|
|
+ synchronized void updateStatus() throws IOException {
|
|
|
|
+ this.status = jobSubmitClient.getJobStatus(profile.getJobID());
|
|
|
|
+ this.statustime = System.currentTimeMillis();
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* An identifier for the job
|
|
* An identifier for the job
|
|
@@ -244,7 +252,7 @@ public class JobClient extends Configured implements MRConstants, Tool {
|
|
* Returns immediately whether the whole job is done yet or not.
|
|
* Returns immediately whether the whole job is done yet or not.
|
|
*/
|
|
*/
|
|
public synchronized boolean isComplete() throws IOException {
|
|
public synchronized boolean isComplete() throws IOException {
|
|
- ensureFreshStatus();
|
|
|
|
|
|
+ updateStatus();
|
|
return (status.getRunState() == JobStatus.SUCCEEDED ||
|
|
return (status.getRunState() == JobStatus.SUCCEEDED ||
|
|
status.getRunState() == JobStatus.FAILED);
|
|
status.getRunState() == JobStatus.FAILED);
|
|
}
|
|
}
|
|
@@ -253,7 +261,7 @@ public class JobClient extends Configured implements MRConstants, Tool {
|
|
* True iff job completed successfully.
|
|
* True iff job completed successfully.
|
|
*/
|
|
*/
|
|
public synchronized boolean isSuccessful() throws IOException {
|
|
public synchronized boolean isSuccessful() throws IOException {
|
|
- ensureFreshStatus();
|
|
|
|
|
|
+ updateStatus();
|
|
return status.getRunState() == JobStatus.SUCCEEDED;
|
|
return status.getRunState() == JobStatus.SUCCEEDED;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -307,7 +315,7 @@ public class JobClient extends Configured implements MRConstants, Tool {
|
|
@Override
|
|
@Override
|
|
public String toString() {
|
|
public String toString() {
|
|
try {
|
|
try {
|
|
- ensureFreshStatus();
|
|
|
|
|
|
+ updateStatus();
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
}
|
|
}
|
|
return "Job: " + profile.getJobID() + "\n" +
|
|
return "Job: " + profile.getJobID() + "\n" +
|