Package org.apache.oozie

Examples of org.apache.oozie.CoordinatorEngine


        writeToFile(appXml, appPath);
        conf.set(OozieClient.COORDINATOR_APP_PATH, appPath);
        conf.set(OozieClient.USER_NAME, getTestUser());
        conf.set(OozieClient.GROUP_NAME, "other");
        injectKerberosInfo(conf);
        CoordinatorEngine ce = new CoordinatorEngine(getTestUser(), "UNIT_TESTING");
        String jobId = ce.submitJob(conf, true);

        assertEquals(jobId.substring(jobId.length() - 2), "-C");
        checkCoordJob(jobId);
        return jobId;
    }
View Full Code Here


     * The catch-up mode time up has been setup in {@link CoordActionMaterializeXCommand}
     * @param jobId job id
     * @throws Exception thrown if failed
     */
    private void _testTimeout(final String jobId) throws Exception {
        final CoordinatorEngine ce = new CoordinatorEngine(getTestUser(), "UNIT_TESTING");

        waitFor(6000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJob job = ce.getCoordJob(jobId);
                return !(job.getStatus().equals(CoordinatorJob.Status.PREP));
            }
        });

        CoordinatorJob job = ce.getCoordJob(jobId);
        assertTrue(!(job.getStatus().equals(CoordinatorJob.Status.PREP)));

        waitFor(6000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJob job = ce.getCoordJob(jobId);
                List<CoordinatorAction> actions = job.getActions();
                return actions.size() > 0;
            }
        });

        job = ce.getCoordJob(jobId);
        List<CoordinatorAction> actions = job.getActions();
        assertTrue(actions.size() > 0);

        for (CoordinatorAction action : actions) {
            JsonCoordinatorAction json = (JsonCoordinatorAction) action;
View Full Code Here

        assertEquals(action.getStatus(), CoordinatorAction.Status.SUCCEEDED);

        Runnable purgeRunnable = new PurgeRunnable(1, 1, 1, 100);
        purgeRunnable.run();

        final CoordinatorEngine engine = new CoordinatorEngine("u", "a");
        waitFor(10000, new Predicate() {
            public boolean evaluate() throws Exception {
                try {
                    engine.getCoordJob(jobId).getStatus();
                }
                catch (Exception ex) {
                    return true;
                }
                return false;
View Full Code Here

        writeToFile(appXml, appPath);
        conf.set(OozieClient.COORDINATOR_APP_PATH, appPath);
        conf.set(OozieClient.USER_NAME, getTestUser());
        conf.set(OozieClient.GROUP_NAME, "other");
        injectKerberosInfo(conf);
        CoordinatorEngine ce = new CoordinatorEngine(getTestUser(), "UNIT_TESTING");
        String jobId = ce.submitJob(conf, true);
        assertEquals(jobId.substring(jobId.length() - 2), "-C");
        checkCoordJob(jobId);
        return jobId;
    }
View Full Code Here

     * @param jobId job id
     * @param createDate create date
     * @throws Exception thrown if failed
     */
    private void _testTimeout(final String jobId, Date createDate) throws Exception {
        final CoordinatorEngine ce = new CoordinatorEngine(getTestUser(), "UNIT_TESTING");

        waitFor(12000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJob job = ce.getCoordJob(jobId);
                return !(job.getStatus().equals(CoordinatorJob.Status.PREP));
            }
        });

        CoordinatorJob job = ce.getCoordJob(jobId);
        assertTrue(!(job.getStatus().equals(CoordinatorJob.Status.PREP)));

        waitFor(12000, new Predicate() {
            public boolean evaluate() throws Exception {
                CoordinatorJob job = ce.getCoordJob(jobId);
                List<CoordinatorAction> actions = job.getActions();
                return actions.size() > 0;
            }
        });

        job = ce.getCoordJob(jobId);
        List<CoordinatorAction> actions = job.getActions();
        assertTrue(actions.size() > 0);

        for (CoordinatorAction action : actions) {
            JsonCoordinatorAction jsonAction = (JsonCoordinatorAction) action;
View Full Code Here

     * @throws CoordinatorEngineException
     */
    private void resumeCoordinatorJob(HttpServletRequest request, HttpServletResponse response)
            throws XServletException {
        String jobId = getResourceName(request);
        CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(
                getUser(request), getAuthToken(request));
        try {
            coordEngine.resume(jobId);
        }
        catch (CoordinatorEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
    }
View Full Code Here

     * @param response servlet response
     * @throws XServletException
     */
    private void suspendCoordinatorJob(HttpServletRequest request, HttpServletResponse response)
            throws XServletException {
        CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(
                getUser(request), getAuthToken(request));
        String jobId = getResourceName(request);
        try {
            coordEngine.suspend(jobId);
        }
        catch (CoordinatorEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
    }
View Full Code Here

     * @param request servlet request
     * @param response servlet response
     * @throws XServletException
     */
    private void killCoordinatorJob(HttpServletRequest request, HttpServletResponse response) throws XServletException {
        CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(
                getUser(request), getAuthToken(request));
        String jobId = getResourceName(request);
        try {
            coordEngine.kill(jobId);
        }
        catch (CoordinatorEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
    }
View Full Code Here

     * @param response servlet response
     * @throws XServletException
     */
    private void changeCoordinatorJob(HttpServletRequest request, HttpServletResponse response)
            throws XServletException {
        CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(
                getUser(request), getAuthToken(request));
        String jobId = getResourceName(request);
        String changeValue = request.getParameter(RestConstants.JOB_CHANGE_VALUE);
        try {
            coordEngine.change(jobId, changeValue);
        }
        catch (CoordinatorEngineException ex) {
            throw new XServletException(HttpServletResponse.SC_BAD_REQUEST, ex);
        }
    }
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    private JSONObject reRunCoordinatorActions(HttpServletRequest request, HttpServletResponse response,
            Configuration conf) throws XServletException {
        JSONObject json = new JSONObject();
        CoordinatorEngine coordEngine = Services.get().get(CoordinatorEngineService.class).getCoordinatorEngine(getUser(request),
                getAuthToken(request));

        String jobId = getResourceName(request);

        String rerunType = request.getParameter(RestConstants.JOB_COORD_RERUN_TYPE_PARAM);
        String scope = request.getParameter(RestConstants.JOB_COORD_RERUN_SCOPE_PARAM);
        String refresh = request.getParameter(RestConstants.JOB_COORD_RERUN_REFRESH_PARAM);
        String noCleanup = request.getParameter(RestConstants.JOB_COORD_RERUN_NOCLEANUP_PARAM);

        XLog.getLog(getClass()).info(
                "Rerun coordinator for jobId=" + jobId + ", rerunType=" + rerunType + ",scope=" + scope + ",refresh="
                        + refresh + ", noCleanup=" + noCleanup);

        try {
            CoordinatorActionInfo coordInfo = coordEngine.reRun(jobId, rerunType, scope, Boolean.valueOf(refresh),
                    Boolean.valueOf(noCleanup));
            List<CoordinatorActionBean> actions = coordInfo.getCoordActions();
            json.put(JsonTags.COORDINATOR_ACTIONS, CoordinatorActionBean.toJSONArray(actions));
        }
        catch (BaseEngineException ex) {
View Full Code Here

TOP

Related Classes of org.apache.oozie.CoordinatorEngine

Copyright © 2018 www.massapicom. 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.