Search in sources :

Example 1 with DagEngine

use of org.apache.oozie.DagEngine in project oozie by apache.

the class CallbackServlet method doGet.

/**
 * GET callback
 */
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String queryString = request.getQueryString();
    CallbackService callbackService = Services.get().get(CallbackService.class);
    if (!callbackService.isValid(queryString)) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0402, queryString);
    }
    String actionId = callbackService.getActionId(queryString);
    if (actionId == null) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0402, queryString);
    }
    log = XLog.getLog(getClass());
    setLogInfo(actionId);
    log.debug("Received a CallbackServlet.doGet() with query string " + queryString);
    DagEngine dagEngine = Services.get().get(DagEngineService.class).getSystemDagEngine();
    try {
        log.info(XLog.STD, "callback for action [{0}]", actionId);
        dagEngine.processCallback(actionId, callbackService.getExternalStatus(queryString), null);
    } catch (DagEngineException ex) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
    }
}
Also used : CallbackService(org.apache.oozie.service.CallbackService) DagEngineException(org.apache.oozie.DagEngineException) DagEngine(org.apache.oozie.DagEngine) DagEngineService(org.apache.oozie.service.DagEngineService)

Example 2 with DagEngine

use of org.apache.oozie.DagEngine in project oozie by apache.

the class V0JobServlet method resumeJob.

/*
     * v0 service method to resume a job
     */
@Override
protected void resumeJob(HttpServletRequest request, HttpServletResponse response) throws XServletException, IOException {
    DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request));
    String jobId = getResourceName(request);
    try {
        dagEngine.resume(jobId);
    } catch (DagEngineException ex) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
    }
}
Also used : DagEngineException(org.apache.oozie.DagEngineException) DagEngine(org.apache.oozie.DagEngine) DagEngineService(org.apache.oozie.service.DagEngineService)

Example 3 with DagEngine

use of org.apache.oozie.DagEngine in project oozie by apache.

the class V0JobServlet method killJob.

/*
     * v0 service method to kill a job
     */
@Override
protected JSONObject killJob(HttpServletRequest request, HttpServletResponse response) throws XServletException, IOException {
    DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request));
    String jobId = getResourceName(request);
    try {
        dagEngine.kill(jobId);
    } catch (DagEngineException ex) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
    }
    return null;
}
Also used : DagEngineException(org.apache.oozie.DagEngineException) DagEngine(org.apache.oozie.DagEngine) DagEngineService(org.apache.oozie.service.DagEngineService)

Example 4 with DagEngine

use of org.apache.oozie.DagEngine in project oozie by apache.

the class V0JobServlet method startJob.

/*
     * v0 service method to start a job
     */
@Override
protected void startJob(HttpServletRequest request, HttpServletResponse response) throws XServletException, IOException {
    DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request));
    String jobId = getResourceName(request);
    try {
        dagEngine.start(jobId);
    } catch (DagEngineException ex) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
    }
}
Also used : DagEngineException(org.apache.oozie.DagEngineException) DagEngine(org.apache.oozie.DagEngine) DagEngineService(org.apache.oozie.service.DagEngineService)

Example 5 with DagEngine

use of org.apache.oozie.DagEngine in project oozie by apache.

the class V0JobServlet method suspendJob.

/*
     * v0 service method to suspend a job
     */
@Override
protected void suspendJob(HttpServletRequest request, HttpServletResponse response) throws XServletException, IOException {
    DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request));
    String jobId = getResourceName(request);
    try {
        dagEngine.suspend(jobId);
    } catch (DagEngineException ex) {
        throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
    }
}
Also used : DagEngineException(org.apache.oozie.DagEngineException) DagEngine(org.apache.oozie.DagEngine) DagEngineService(org.apache.oozie.service.DagEngineService)

Aggregations

DagEngine (org.apache.oozie.DagEngine)36 DagEngineService (org.apache.oozie.service.DagEngineService)22 DagEngineException (org.apache.oozie.DagEngineException)19 XConfiguration (org.apache.oozie.util.XConfiguration)15 Reader (java.io.Reader)14 Writer (java.io.Writer)14 Configuration (org.apache.hadoop.conf.Configuration)14 FileWriter (java.io.FileWriter)13 File (java.io.File)12 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)9 JSONObject (org.json.simple.JSONObject)8 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)7 WorkflowActionsGetForJobJPAExecutor (org.apache.oozie.executor.jpa.WorkflowActionsGetForJobJPAExecutor)5 WorkflowJobGetJPAExecutor (org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor)5 IOException (java.io.IOException)4 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)4 JPAService (org.apache.oozie.service.JPAService)4 WorkflowStore (org.apache.oozie.store.WorkflowStore)4 Date (java.util.Date)3 WorkflowsInfo (org.apache.oozie.WorkflowsInfo)3