Search in sources :

Example 1 with Job

use of org.apache.asterix.common.utils.Job in project asterixdb by apache.

the class APIFramework method executeJobArray.

public void executeJobArray(IHyracksClientConnection hcc, Job[] jobs, PrintWriter out) throws Exception {
    for (Job job : jobs) {
        job.getJobSpec().setMaxReattempts(0);
        long startTime = System.currentTimeMillis();
        try {
            JobId jobId = hcc.startJob(job.getJobSpec());
            if (job.getSubmissionMode() == SubmissionMode.ASYNCHRONOUS) {
                continue;
            }
            hcc.waitForCompletion(jobId);
        } catch (Exception e) {
            e.printStackTrace();
            continue;
        }
        long endTime = System.currentTimeMillis();
        double duration = (endTime - startTime) / 1000.00;
        out.println("<pre>Duration: " + duration + " sec</pre>");
    }
}
Also used : Job(org.apache.asterix.common.utils.Job) JobId(org.apache.hyracks.api.job.JobId) ACIDException(org.apache.asterix.common.exceptions.ACIDException) AlgebricksException(org.apache.hyracks.algebricks.common.exceptions.AlgebricksException) RemoteException(java.rmi.RemoteException) AsterixException(org.apache.asterix.common.exceptions.AsterixException) CompilationException(org.apache.asterix.common.exceptions.CompilationException) IOException(java.io.IOException) HyracksException(org.apache.hyracks.api.exceptions.HyracksException)

Aggregations

IOException (java.io.IOException)1 RemoteException (java.rmi.RemoteException)1 ACIDException (org.apache.asterix.common.exceptions.ACIDException)1 AsterixException (org.apache.asterix.common.exceptions.AsterixException)1 CompilationException (org.apache.asterix.common.exceptions.CompilationException)1 Job (org.apache.asterix.common.utils.Job)1 AlgebricksException (org.apache.hyracks.algebricks.common.exceptions.AlgebricksException)1 HyracksException (org.apache.hyracks.api.exceptions.HyracksException)1 JobId (org.apache.hyracks.api.job.JobId)1