use of org.apache.hyracks.api.job.JobStatus in project asterixdb by apache.
the class JobEventListenerFactory method createListener.
@Override
public IJobletEventListener createListener(final IHyracksJobletContext jobletContext) {
return new IJobletEventListener() {
@Override
public void jobletFinish(JobStatus jobStatus) {
try {
ITransactionManager txnManager = ((INcApplicationContext) jobletContext.getServiceContext().getApplicationContext()).getTransactionSubsystem().getTransactionManager();
ITransactionContext txnContext = txnManager.getTransactionContext(jobId, false);
txnContext.setWriteTxn(transactionalWrite);
txnManager.completedTransaction(txnContext, DatasetId.NULL, -1, !(jobStatus == JobStatus.FAILURE));
} catch (ACIDException e) {
throw new Error(e);
}
}
@Override
public void jobletStart() {
try {
((INcApplicationContext) jobletContext.getServiceContext().getApplicationContext()).getTransactionSubsystem().getTransactionManager().getTransactionContext(jobId, true);
} catch (ACIDException e) {
throw new Error(e);
}
}
};
}
use of org.apache.hyracks.api.job.JobStatus in project asterixdb by apache.
the class FeedEventsListener method finish.
private void finish() throws Exception {
IHyracksClientConnection hcc = appCtx.getHcc();
JobStatus status = hcc.getJobStatus(jobId);
state = status.equals(JobStatus.FAILURE) ? ActivityState.FAILED : ActivityState.STOPPED;
ActiveLifecycleListener activeLcListener = (ActiveLifecycleListener) appCtx.getActiveLifecycleListener();
activeLcListener.getNotificationHandler().removeListener(this);
}
use of org.apache.hyracks.api.job.JobStatus in project asterixdb by apache.
the class GetJobStatusWork method doRun.
@Override
protected void doRun() throws Exception {
try {
JobRun run = jobManager.get(jobId);
JobStatus status = run == null ? null : run.getStatus();
callback.setValue(status);
} catch (Exception e) {
callback.setException(e);
}
}
use of org.apache.hyracks.api.job.JobStatus in project asterixdb by apache.
the class MultiTransactionJobletEventListenerFactory method createListener.
@Override
public IJobletEventListener createListener(final IHyracksJobletContext jobletContext) {
return new IJobletEventListener() {
@Override
public void jobletFinish(JobStatus jobStatus) {
try {
ITransactionManager txnManager = ((INcApplicationContext) jobletContext.getServiceContext().getApplicationContext()).getTransactionSubsystem().getTransactionManager();
for (JobId jobId : jobIds) {
ITransactionContext txnContext = txnManager.getTransactionContext(jobId, false);
txnContext.setWriteTxn(transactionalWrite);
txnManager.completedTransaction(txnContext, DatasetId.NULL, -1, !(jobStatus == JobStatus.FAILURE));
}
} catch (ACIDException e) {
throw new Error(e);
}
}
@Override
public void jobletStart() {
try {
for (JobId jobId : jobIds) {
((INcApplicationContext) jobletContext.getServiceContext().getApplicationContext()).getTransactionSubsystem().getTransactionManager().getTransactionContext(jobId, true);
}
} catch (ACIDException e) {
throw new Error(e);
}
}
};
}
Aggregations