Examples of DagEngine


Examples of org.apache.oozie.DagEngine

                throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0303,
                        RestConstants.ACTION_PARAM, action);
            }
            boolean startJob = (action != null);
            String user = conf.get(OozieClient.USER_NAME);
            DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(user, getAuthToken(request));
            String id;
            boolean dryrun = false;
            if (action != null) {
                dryrun = (action.equals(RestConstants.JOB_ACTION_DRYRUN));
            }
            if (dryrun) {
                id = dagEngine.dryRunSubmit(conf);
            }
            else {
                id = dagEngine.submitJob(conf, startJob);
            }
            json.put(JsonTags.JOB_ID, id);
        }
        catch (BaseEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
View Full Code Here

Examples of org.apache.oozie.DagEngine

    @SuppressWarnings("unchecked")
    private JSONObject getWorkflowJobIdForExternalId(HttpServletRequest request, String externalId)
            throws XServletException {
        JSONObject json = new JSONObject();
        try {
            DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request),
                    getAuthToken(request));
            String jobId = dagEngine.getJobIdForExternalId(externalId);
            json.put(JsonTags.JOB_ID, jobId);
        }
        catch (DagEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
View Full Code Here

Examples of org.apache.oozie.DagEngine

                    ? "GMT" : request.getParameter(RestConstants.TIME_ZONE_PARAM);
            int start = (startStr != null) ? Integer.parseInt(startStr) : 1;
            start = (start < 1) ? 1 : start;
            int len = (lenStr != null) ? Integer.parseInt(lenStr) : 50;
            len = (len < 1) ? 50 : len;
            DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request),
                    getAuthToken(request));
            WorkflowsInfo jobs = dagEngine.getJobs(filter, start, len);
            List<WorkflowJobBean> jsonWorkflows = jobs.getWorkflows();
            json.put(JsonTags.WORKFLOWS_JOBS, WorkflowJobBean.toJSONArray(jsonWorkflows, timeZoneId));
            json.put(JsonTags.WORKFLOWS_TOTAL, jobs.getTotal());
            json.put(JsonTags.WORKFLOWS_OFFSET, jobs.getStart());
            json.put(JsonTags.WORKFLOWS_LEN, jobs.getLen());
View Full Code Here

Examples of org.apache.oozie.DagEngine

            throws XServletException {
        JSONObject json = new JSONObject();

        try {
            String user = conf.get(OozieClient.USER_NAME);
            DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(user, getAuthToken(request));
            String id = dagEngine.submitHttpJob(conf, jobType);
            json.put(JsonTags.JOB_ID, id);
        }
        catch (DagEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
View Full Code Here

Examples of org.apache.oozie.DagEngine

        }
        catch (AuthorizationException ex) {
            throw new XServletException(HttpServletResponse.SC_UNAUTHORIZED, ex);
        }

        DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request),
                                                                                      getAuthToken(request));
        CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(
                getUser(request), getAuthToken(request));
        try {
            String action = request.getParameter(RestConstants.ACTION_PARAM);
            if (action.equals(RestConstants.JOB_ACTION_START)) {
                stopCron();
                dagEngine.start(jobId);
                startCron();
                response.setStatus(HttpServletResponse.SC_OK);
            }
            else if (action.equals(RestConstants.JOB_ACTION_RESUME)) {
                stopCron();
                dagEngine.resume(jobId);
                startCron();
                response.setStatus(HttpServletResponse.SC_OK);
            }
            else if (action.equals(RestConstants.JOB_ACTION_SUSPEND)) {
                stopCron();
                dagEngine.suspend(jobId);
                startCron();
                response.setStatus(HttpServletResponse.SC_OK);
            }
            else if (action.equals(RestConstants.JOB_ACTION_KILL)) {
                stopCron();
                dagEngine.kill(jobId);
                startCron();
                response.setStatus(HttpServletResponse.SC_OK);
            }
            else if (action.equals(RestConstants.JOB_ACTION_RERUN)) {
                validateContentType(request, RestConstants.XML_CONTENT_TYPE);
                XConfiguration conf = new XConfiguration(request.getInputStream());
                stopCron();
                conf = conf.trim();
                conf = conf.resolve();
                JobsServlet.validateJobConfiguration(conf);
                checkAuthorizationForApp(getUser(request), conf);
                dagEngine.reRun(jobId, conf);
                startCron();
                response.setStatus(HttpServletResponse.SC_OK);
            }
            else if (action.equals(RestConstants.JOB_COORD_ACTION_RERUN)) {
                validateContentType(request, RestConstants.XML_CONTENT_TYPE);
View Full Code Here

Examples of org.apache.oozie.DagEngine

        }
        catch (AuthorizationException ex) {
            throw new XServletException(HttpServletResponse.SC_UNAUTHORIZED, ex);
        }

        DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(getUser(request),
                                                                                      getAuthToken(request));
        try {
            if (show == null || show.equals(RestConstants.JOB_SHOW_INFO)) {
                stopCron();
                JsonWorkflowJob job = (JsonWorkflowJob) dagEngine.getJob(jobId);
                startCron();
                sendJsonResponse(response, HttpServletResponse.SC_OK, job);
            }
            else {
                if (show.equals(RestConstants.JOB_SHOW_LOG)) {
                    response.setContentType(TEXT_UTF8);
                    dagEngine.streamLog(jobId, response.getWriter());
                }
                else {
                    if (show.equals(RestConstants.JOB_SHOW_DEFINITION)) {
                        stopCron();
                        response.setContentType(XML_UTF8);
                        String wfDefinition = dagEngine.getDefinition(jobId);
                        startCron();
                        response.setStatus(HttpServletResponse.SC_OK);
                        response.getWriter().write(wfDefinition);
                    }
                    else {
View Full Code Here

Examples of org.apache.oozie.DagEngine

        }
        setLogInfo(jobId, actionId);
        log = XLog.getLog(getClass());
        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);
        }
    }
View Full Code Here

Examples of org.apache.oozie.DagEngine

        validateContentType(request, RestConstants.TEXT_CONTENT_TYPE);
        try {
            log.info(XLog.STD, "callback for action [{0}]", actionId);
            String data = IOUtils.getReaderAsString(request.getReader(), maxDataLen);
            Properties props = PropertiesUtils.stringToProperties(data);
            DagEngine dagEngine = Services.get().get(DagEngineService.class).getSystemDagEngine();
            dagEngine.processCallback(actionId, callbackService.getExternalStatus(queryString), props);
        }
        catch (IOException ex) {
            if (ex.getMessage().startsWith("stream exceeds limit")) {
                // TODO, WE MUST SET THE ACTION TO ERROR
                throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ErrorCode.E0403, "data too long");
View Full Code Here

Examples of org.apache.oozie.DagEngine

                                        action);
        }
        try {
            boolean startJob = (action != null);
            String user = conf.get(OozieClient.USER_NAME);
            DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(user, getAuthToken(request));
            String id = dagEngine.submitJob(conf, startJob);
            JSONObject json = new JSONObject();
            json.put(JsonTags.JOB_ID, id);
            startCron();
            sendJsonResponse(response, HttpServletResponse.SC_CREATED, json);
        }
View Full Code Here

Examples of org.apache.oozie.DagEngine

    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        try {
            String externalId = request.getParameter(RestConstants.JOBS_EXTERNAL_ID_PARAM);
            if (externalId != null) {
                stopCron();
                DagEngine dagEngine = Services.get().get(DagEngineService.class)
                        .getDagEngine(getUser(request), getAuthToken(request));
                String jobId = dagEngine.getJobIdForExternalId(externalId);
                JSONObject json = new JSONObject();
                json.put(JsonTags.JOB_ID, jobId);
                startCron();
                sendJsonResponse(response, HttpServletResponse.SC_OK, json);
            }
            else {
                String filter = request.getParameter(RestConstants.JOBS_FILTER_PARAM);
                String startStr = request.getParameter(RestConstants.OFFSET_PARAM);
                String lenStr = request.getParameter(RestConstants.LEN_PARAM);
                int start = (startStr != null) ? Integer.parseInt(startStr) : 1;
                start = (start < 1) ? 1 : start;
                int len = (lenStr != null) ? Integer.parseInt(lenStr) : 50;
                len = (len < 1) ? 50 : len;
                stopCron();
                DagEngine dagEngine = Services.get().get(DagEngineService.class)
                        .getDagEngine(getUser(request), getAuthToken(request));
                WorkflowsInfo jobs = dagEngine.getJobs(filter, start, len);
                List<WorkflowJobBean> jsonWorkflows = jobs.getWorkflows();
                startCron();
                JSONObject json = new JSONObject();
                json.put(JsonTags.WORKFLOWS_JOBS, WorkflowJobBean.toJSONArray(jsonWorkflows));
                json.put(JsonTags.WORKFLOWS_TOTAL, jobs.getTotal());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.