Search in sources :

Example 1 with DagEngineException

use of org.apache.oozie.DagEngineException 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 DagEngineException

use of org.apache.oozie.DagEngineException 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 DagEngineException

use of org.apache.oozie.DagEngineException 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 DagEngineException

use of org.apache.oozie.DagEngineException 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 DagEngineException

use of org.apache.oozie.DagEngineException 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)19 DagEngineException (org.apache.oozie.DagEngineException)19 DagEngineService (org.apache.oozie.service.DagEngineService)18 JSONObject (org.json.simple.JSONObject)7 WorkflowsInfo (org.apache.oozie.WorkflowsInfo)3 IOException (java.io.IOException)2 Date (java.util.Date)2 Configuration (org.apache.hadoop.conf.Configuration)2 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)2 JsonBean (org.apache.oozie.client.rest.JsonBean)2 JPAExecutorException (org.apache.oozie.executor.jpa.JPAExecutorException)2 CallbackService (org.apache.oozie.service.CallbackService)2 XConfiguration (org.apache.oozie.util.XConfiguration)2 File (java.io.File)1 FileWriter (java.io.FileWriter)1 Reader (java.io.Reader)1 StringReader (java.io.StringReader)1 Writer (java.io.Writer)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1