use of org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery in project oozie by apache.
the class BundleJobResumeXCommand method updateBundleAction.
private void updateBundleAction(BundleActionBean action) {
if (action.getStatus() == Job.Status.PREPSUSPENDED) {
action.setStatus(Job.Status.PREP);
} else if (action.getStatus() == Job.Status.SUSPENDED) {
action.setStatus(Job.Status.RUNNING);
} else if (action.getStatus() == Job.Status.SUSPENDEDWITHERROR) {
action.setStatus(Job.Status.RUNNINGWITHERROR);
}
action.incrementAndGetPending();
action.setLastModifiedTime(new Date());
updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
}
use of org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery in project oozie by apache.
the class BundleRerunXCommand method updateBundleAction.
/**
* Update bundle action
*
* @param action the bundle action
* @throws CommandException thrown if failed to update bundle action
*/
private void updateBundleAction(BundleActionBean action) {
action.incrementAndGetPending();
action.setLastModifiedTime(new Date());
updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_PENDING_MODTIME, action));
}
use of org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery in project oozie by apache.
the class BundleJobSuspendXCommand method updateBundleAction.
private void updateBundleAction(BundleActionBean action) {
if (action.getStatus() == Job.Status.PREP) {
action.setStatus(Job.Status.PREPSUSPENDED);
} else if (action.getStatus() == Job.Status.RUNNING) {
action.setStatus(Job.Status.SUSPENDED);
} else if (action.getStatus() == Job.Status.RUNNINGWITHERROR) {
action.setStatus(Job.Status.SUSPENDEDWITHERROR);
} else if (action.getStatus() == Job.Status.PAUSED) {
action.setStatus(Job.Status.SUSPENDED);
} else if (action.getStatus() == Job.Status.PAUSEDWITHERROR) {
action.setStatus(Job.Status.SUSPENDEDWITHERROR);
}
action.incrementAndGetPending();
action.setLastModifiedTime(new Date());
updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
}
use of org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery in project oozie by apache.
the class BundleKillXCommand method updateBundleAction.
/**
* Update bundle action
*
* @param action
* @throws CommandException
*/
private void updateBundleAction(BundleActionBean action) {
action.setLastModifiedTime(new Date());
if (!action.isTerminalStatus()) {
action.incrementAndGetPending();
action.setStatus(Job.Status.KILLED);
} else {
// while coordinator is killed.
if (action.isPending()) {
if (action.getCoordId() == null) {
action.setPending(0);
} else {
try {
CoordinatorJobBean coordJob = CoordJobQueryExecutor.getInstance().get(CoordJobQuery.GET_COORD_JOB, action.getCoordId());
if (!coordJob.isPending() && coordJob.isTerminalStatus()) {
action.setPending(0);
action.setStatus(coordJob.getStatus());
}
} catch (JPAExecutorException e) {
LOG.warn("Error in checking coord job status:" + action.getCoordId(), e);
}
}
}
}
updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
}
use of org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery in project oozie by apache.
the class BatchQueryExecutor method executeBatchInsertUpdateDelete.
@SuppressWarnings("rawtypes")
public void executeBatchInsertUpdateDelete(Collection<JsonBean> insertList, Collection<UpdateEntry> updateList, Collection<JsonBean> deleteList) throws JPAExecutorException {
List<QueryEntry> queryList = new ArrayList<QueryEntry>();
JPAService jpaService = Services.get().get(JPAService.class);
EntityManager em = jpaService.getEntityManager();
if (updateList != null) {
for (UpdateEntry entry : updateList) {
Query query = null;
JsonBean bean = entry.getBean();
if (bean instanceof WorkflowJobBean) {
query = WorkflowJobQueryExecutor.getInstance().getUpdateQuery((WorkflowJobQuery) entry.getQueryName(), (WorkflowJobBean) entry.getBean(), em);
} else if (bean instanceof WorkflowActionBean) {
query = WorkflowActionQueryExecutor.getInstance().getUpdateQuery((WorkflowActionQuery) entry.getQueryName(), (WorkflowActionBean) entry.getBean(), em);
} else if (bean instanceof CoordinatorJobBean) {
query = CoordJobQueryExecutor.getInstance().getUpdateQuery((CoordJobQuery) entry.getQueryName(), (CoordinatorJobBean) entry.getBean(), em);
} else if (bean instanceof CoordinatorActionBean) {
query = CoordActionQueryExecutor.getInstance().getUpdateQuery((CoordActionQuery) entry.getQueryName(), (CoordinatorActionBean) entry.getBean(), em);
} else if (bean instanceof BundleJobBean) {
query = BundleJobQueryExecutor.getInstance().getUpdateQuery((BundleJobQuery) entry.getQueryName(), (BundleJobBean) entry.getBean(), em);
} else if (bean instanceof BundleActionBean) {
query = BundleActionQueryExecutor.getInstance().getUpdateQuery((BundleActionQuery) entry.getQueryName(), (BundleActionBean) entry.getBean(), em);
} else if (bean instanceof SLARegistrationBean) {
query = SLARegistrationQueryExecutor.getInstance().getUpdateQuery((SLARegQuery) entry.getQueryName(), (SLARegistrationBean) entry.getBean(), em);
} else if (bean instanceof SLASummaryBean) {
query = SLASummaryQueryExecutor.getInstance().getUpdateQuery((SLASummaryQuery) entry.getQueryName(), (SLASummaryBean) entry.getBean(), em);
} else {
throw new JPAExecutorException(ErrorCode.E0603, "BatchQueryExecutor failed to construct a query");
}
queryList.add(new QueryEntry(entry.getQueryName(), query));
}
}
jpaService.executeBatchInsertUpdateDelete(insertList, queryList, deleteList, em);
}
Aggregations