use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.
the class QueryTranslator method asyncCreateAndRunJob.
private void asyncCreateAndRunJob(IHyracksClientConnection hcc, IStatementCompiler compiler, IMetadataLocker locker, ResultDelivery resultDelivery, String clientContextId, IStatementExecutorContext ctx, ResultSetId resultSetId, MutableBoolean printed) {
Mutable<JobId> jobId = new MutableObject<>(JobId.INVALID);
try {
createAndRunJob(hcc, jobId, compiler, locker, resultDelivery, id -> {
final ResultHandle handle = new ResultHandle(id, resultSetId);
ResultUtil.printStatus(sessionOutput, AbstractQueryApiServlet.ResultStatus.RUNNING);
ResultUtil.printResultHandle(sessionOutput, handle);
synchronized (printed) {
printed.setTrue();
printed.notify();
}
}, clientContextId, ctx);
} catch (Exception e) {
if (JobId.INVALID.equals(jobId.getValue())) {
// compilation failed
ResultUtil.printStatus(sessionOutput, AbstractQueryApiServlet.ResultStatus.FAILED);
ResultUtil.printError(sessionOutput.out(), e);
} else {
GlobalConfig.ASTERIX_LOGGER.log(Level.SEVERE, resultDelivery.name() + " job with id " + jobId.getValue() + " " + "failed", e);
}
} finally {
synchronized (printed) {
if (printed.isFalse()) {
printed.setTrue();
printed.notify();
}
}
}
}
use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.
the class GlobalRecoveryManager method executeHyracksJob.
private void executeHyracksJob(JobSpecification spec) throws Exception {
spec.setMaxReattempts(0);
JobId jobId = hcc.startJob(spec);
hcc.waitForCompletion(jobId);
}
use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.
the class TestNodeController method init.
public void init() throws Exception {
try {
File outdir = new File(PATH_ACTUAL);
outdir.mkdirs();
// remove library directory
TestLibrarian.removeLibraryDir();
ExecutionTestUtil.setUp(cleanupOnStart, testConfigFileName == null ? TEST_CONFIG_FILE_NAME : testConfigFileName, ExecutionTestUtil.integrationUtil, runHDFS);
} catch (Throwable th) {
th.printStackTrace();
throw th;
}
jobletCtx = Mockito.mock(IHyracksJobletContext.class);
Mockito.when(jobletCtx.getServiceContext()).thenReturn(ExecutionTestUtil.integrationUtil.ncs[0].getContext());
Mockito.when(jobletCtx.getJobId()).thenAnswer(new Answer<JobId>() {
@Override
public JobId answer(InvocationOnMock invocation) throws Throwable {
return jobId;
}
});
}
use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.
the class StartTasksWork method getOrCreateLocalJoblet.
private Joblet getOrCreateLocalJoblet(DeploymentId deploymentId, JobId jobId, INCServiceContext appCtx, byte[] acgBytes) throws HyracksException {
Map<JobId, Joblet> jobletMap = ncs.getJobletMap();
Joblet ji = jobletMap.get(jobId);
if (ji == null) {
ActivityClusterGraph acg = ncs.getActivityClusterGraph(jobId);
if (acg == null) {
if (acgBytes == null) {
throw HyracksException.create(ErrorCode.ERROR_FINDING_DISTRIBUTED_JOB, jobId);
}
acg = (ActivityClusterGraph) DeploymentUtils.deserialize(acgBytes, deploymentId, appCtx);
}
ji = new Joblet(ncs, deploymentId, jobId, appCtx, acg);
jobletMap.put(jobId, ji);
}
return ji;
}
use of org.apache.hyracks.api.job.JobId in project asterixdb by apache.
the class NotifyTaskFailureWork method run.
@Override
public void run() {
try {
JobId jobId = task.getJobletContext().getJobId();
IDatasetPartitionManager dpm = ncs.getDatasetPartitionManager();
if (dpm != null) {
dpm.abortReader(jobId);
}
ncs.getClusterController().notifyTaskFailure(jobId, task.getTaskAttemptId(), ncs.getId(), exceptions);
//exceptions.get(0).printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
task.getJoblet().removeTask(task);
}
Aggregations