Examples of SLAEventBean


Examples of org.apache.oozie.SLAEventBean

     */
    private void createActionRegistration(String actionXml, CoordinatorActionBean actionBean, CoordinatorStore store)
            throws Exception {
        Element eAction = XmlUtils.parseXml(actionXml);
        Element eSla = eAction.getChild("action", eAction.getNamespace()).getChild("info", eAction.getNamespace("sla"));
        SLAEventBean slaEvent = SLADbOperations.createSlaRegistrationEvent(eSla, store, actionBean.getId(),
                SlaAppType.COORDINATOR_ACTION, user, group);
        if(slaEvent != null) {
            insertList.add(slaEvent);
        }
    }
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

        // System.out.println("BBBBB SLA added");
        if (eSla == null) {
            return null;
        }
        // System.out.println("Writing REG AAAAA " + slaId);
        SLAEventBean sla = new SLAEventBean();
        // sla.setClientId(getTagElement( eSla, "client-id"));
        // sla.setClientId(getClientId());
        sla.setAppName(getTagElement(eSla, "app-name"));
        sla.setParentClientId(getTagElement(eSla, "parent-child-id"));
        sla.setParentSlaId(getTagElement(eSla, "parent-sla-id"));
        String strNominalTime = getTagElement(eSla, "nominal-time");
        // System.out.println("AAAAA SLA nominal time "+ strNominalTime);
        if (strNominalTime == null || strNominalTime.length() == 0) {
            throw new RuntimeException("Nominal time is required"); // TODO:
            // change to
            // CommandException
        }
        Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
        // Setting expected start time
        String strRelExpectedStart = getTagElement(eSla, "should-start");
        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
            throw new RuntimeException("should-start can't be empty");
        }
        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
        if (relExpectedStart < 0) {
            sla.setExpectedStart(null);
        }
        else {
            Date expectedStart = new Date(nominalTime.getTime() + relExpectedStart * 60 * 1000);
            sla.setExpectedStart(expectedStart);
            // sla.setExpectedStart(nominalTime);
        }

        // Setting expected end time
        String strRelExpectedEnd = getTagElement(eSla, "should-end");
        if (strRelExpectedEnd == null || strRelExpectedEnd.length() == 0) {
            throw new RuntimeException("should-end can't be empty");
        }
        int relExpectedEnd = Integer.parseInt(strRelExpectedEnd);
        if (relExpectedEnd < 0) {
            sla.setExpectedEnd(null);
        }
        else {
            Date expectedEnd = new Date(nominalTime.getTime() + relExpectedEnd * 60 * 1000);
            sla.setExpectedEnd(expectedEnd);
        }

        sla.setNotificationMsg(getTagElement(eSla, "notification-msg"));
        sla.setAlertContact(getTagElement(eSla, "alert-contact"));
        sla.setDevContact(getTagElement(eSla, "dev-contact"));
        sla.setQaContact(getTagElement(eSla, "qa-contact"));
        sla.setSeContact(getTagElement(eSla, "se-contact"));
        sla.setAlertFrequency(getTagElement(eSla, "alert-frequency"));
        sla.setAlertPercentage(getTagElement(eSla, "alert-percentage"));

        sla.setUpstreamApps(getTagElement(eSla, "upstream-apps"));

        // Oozie defined

        sla.setSlaId(slaId);
        sla.setAppType(appType);
        sla.setUser(user);
        sla.setGroupName(groupName);
        sla.setJobStatus(Status.CREATED);
        sla.setStatusTimestamp(new Date());

        return sla;
    }
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

        // System.out.println("BBBBB SLA added");
        if (eSla == null) {
            return null;
        }
        //System.out.println("Writing REG AAAAA " + slaId);
        SLAEventBean sla = new SLAEventBean();
        // sla.setClientId(getTagElement( eSla, "client-id"));
        // sla.setClientId(getClientId());
        sla.setAppName(getTagElement(eSla, "app-name"));
        sla.setParentClientId(getTagElement(eSla, "parent-child-id"));
        sla.setParentSlaId(getTagElement(eSla, "parent-sla-id"));
        String strNominalTime = getTagElement(eSla, "nominal-time");
        // System.out.println("AAAAA SLA nominal time "+ strNominalTime);
        if (strNominalTime == null || strNominalTime.length() == 0) {
            throw new RuntimeException("Nominal time is required"); // TODO:
            // change to
            // CommandException
        }
        Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
        // Setting expected start time
        String strRelExpectedStart = getTagElement(eSla, "should-start");
        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
            throw new RuntimeException("should-start can't be empty");
        }
        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
        if (relExpectedStart < 0) {
            sla.setExpectedStart(null);
        }
        else {
            Date expectedStart = new Date(nominalTime.getTime()
                    + relExpectedStart * 60 * 1000);
            sla.setExpectedStart(expectedStart);
            // sla.setExpectedStart(nominalTime);
        }

        // Setting expected end time
        String strRelExpectedEnd = getTagElement(eSla, "should-end");
        if (strRelExpectedEnd == null || strRelExpectedEnd.length() == 0) {
            throw new RuntimeException("should-end can't be empty");
        }
        int relExpectedEnd = Integer.parseInt(strRelExpectedEnd);
        if (relExpectedEnd < 0) {
            sla.setExpectedEnd(null);
        }
        else {
            Date expectedEnd = new Date(nominalTime.getTime() + relExpectedEnd
                    * 60 * 1000);
            sla.setExpectedEnd(expectedEnd);
        }

        sla.setNotificationMsg(getTagElement(eSla, "notification-msg"));
        sla.setAlertContact(getTagElement(eSla, "alert-contact"));
        sla.setDevContact(getTagElement(eSla, "dev-contact"));
        sla.setQaContact(getTagElement(eSla, "qa-contact"));
        sla.setSeContact(getTagElement(eSla, "se-contact"));
        sla.setAlertFrequency(getTagElement(eSla, "alert-frequency"));
        sla.setAlertPercentage(getTagElement(eSla, "alert-percentage"));

        sla.setUpstreamApps(getTagElement(eSla, "upstream-apps"));

        // Oozie defined

        sla.setSlaId(slaId);
        sla.setAppType(appType);
        sla.setUser(user);
        sla.setGroupName(groupName);
        sla.setJobStatus(Status.CREATED);
        sla.setStatusTimestamp(new Date());

        //SLAStore slaStore = (SLAStore) Services.get().get(StoreService.class)
        //        .getStore(SLAStore.class, store);
        //slaStore.insertSLAEvent(sla);

View Full Code Here

Examples of org.apache.oozie.SLAEventBean

        return sla;
    }

    public static SLAEventBean createSlaStatusEvent(String id,
                                           Status status, Store store, SlaAppType appType) throws Exception {
        SLAEventBean sla = new SLAEventBean();
        sla.setSlaId(id);
        sla.setJobStatus(status);
        sla.setAppType(appType);
        sla.setStatusTimestamp(new Date());
        //System.out.println("Writing STATUS AAAAA " + id);
        //SLAStore slaStore = (SLAStore) Services.get().get(StoreService.class)
                //.getStore(SLAStore.class, store);
        //slaStore.insertSLAEvent(sla);
        return sla;
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

        //slaStore.insertSLAEvent(sla);
        return sla;
    }

    public static SLAEventBean createSlaStatusEvent(String id, Status status, SlaAppType appType, XLog log) throws Exception {
        SLAEventBean sla = new SLAEventBean();
        sla.setSlaId(id);
        sla.setJobStatus(status);
        sla.setAppType(appType);
        sla.setStatusTimestamp(new Date());
        // System.out.println("Writing STATUS AAAAA " + id);
        //SLAStore slaStore = (SLAStore) Services.get().get(StoreService.class).getStore(SLAStore.class, store);
        //slaStore.insertSLAEvent(sla);

        return sla;
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

                                                 SlaAppType appType, String user, String groupName)
            throws Exception {
        if (eSla == null) {
            return null;
        }
        SLAEventBean sla = new SLAEventBean();
        // sla.setClientId(getTagElement( eSla, "client-id"));
        // sla.setClientId(getClientId());
        sla.setAppName(getTagElement(eSla, "app-name"));
        sla.setParentClientId(getTagElement(eSla, "parent-child-id"));
        sla.setParentSlaId(getTagElement(eSla, "parent-sla-id"));
        String strNominalTime = getTagElement(eSla, "nominal-time");
        if (strNominalTime == null || strNominalTime.length() == 0) {
            throw new CommandException(ErrorCode.E1101);
        }
        Date nominalTime = DateUtils.parseDateOozieTZ(strNominalTime);
        // Setting expected start time
        String strRelExpectedStart = getTagElement(eSla, "should-start");
        if (strRelExpectedStart == null || strRelExpectedStart.length() == 0) {
            throw new CommandException(ErrorCode.E1102);
        }
        int relExpectedStart = Integer.parseInt(strRelExpectedStart);
        if (relExpectedStart < 0) {
            sla.setExpectedStart(null);
        }
        else {
            Date expectedStart = new Date(nominalTime.getTime()
                    + relExpectedStart * 60 * 1000);
            sla.setExpectedStart(expectedStart);
        }

        // Setting expected end time
        String strRelExpectedEnd = getTagElement(eSla, "should-end");
        if (strRelExpectedEnd == null || strRelExpectedEnd.length() == 0) {
            throw new RuntimeException("should-end can't be empty");
        }
        int relExpectedEnd = Integer.parseInt(strRelExpectedEnd);
        if (relExpectedEnd < 0) {
            sla.setExpectedEnd(null);
        }
        else {
            Date expectedEnd = new Date(nominalTime.getTime() + relExpectedEnd * 60 * 1000);
            sla.setExpectedEnd(expectedEnd);
        }

        sla.setNotificationMsg(getTagElement(eSla, "notification-msg"));
        sla.setAlertContact(getTagElement(eSla, "alert-contact"));
        sla.setDevContact(getTagElement(eSla, "dev-contact"));
        sla.setQaContact(getTagElement(eSla, "qa-contact"));
        sla.setSeContact(getTagElement(eSla, "se-contact"));
        sla.setAlertFrequency(getTagElement(eSla, "alert-frequency"));
        sla.setAlertPercentage(getTagElement(eSla, "alert-percentage"));

        sla.setUpstreamApps(getTagElement(eSla, "upstream-apps"));

        // Oozie defined
        sla.setSlaId(slaId);
        sla.setAppType(appType);
        sla.setUser(user);
        sla.setGroupName(groupName);
        sla.setJobStatus(Status.CREATED);
        sla.setStatusTimestamp(new Date());

        return sla;

    }
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

     * @param appType SLA app type
     * @throws Exception
     */
    public static SLAEventBean createSlaStatusEvent(String id,
                                           Status status, SlaAppType appType) throws Exception {
        SLAEventBean sla = new SLAEventBean();
        sla.setSlaId(id);
        sla.setJobStatus(status);
        sla.setAppType(appType);
        sla.setStatusTimestamp(new Date());

        return sla;
    }
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

                            + coordAction.getStatus());
            coordAction.setLastModifiedTime(new Date());
            updateList.add(coordAction);

            if (slaStatus != null) {
                SLAEventBean slaEvent = SLADbOperations.createStatusEvent(coordAction.getSlaXml(), coordAction.getId(), slaStatus,
                        SlaAppType.COORDINATOR_ACTION, LOG);
                if(slaEvent != null) {
                    insertList.add(slaEvent);
                }
            }
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

     */
    private void writeActionRegistration(String actionXml, CoordinatorActionBean actionBean, String user, String group)
            throws Exception {
        Element eAction = XmlUtils.parseXml(actionXml);
        Element eSla = eAction.getChild("action", eAction.getNamespace()).getChild("info", eAction.getNamespace("sla"));
        SLAEventBean slaEvent = SLADbOperations.createSlaRegistrationEvent(eSla, actionBean.getId(),
                SlaAppType.COORDINATOR_ACTION, user, group, LOG);
        if(slaEvent != null) {
            insertList.add(slaEvent);
        }
    }
View Full Code Here

Examples of org.apache.oozie.SLAEventBean

            // XmlUtils.prettyPrint(runConf).toString());
            DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(user, authToken);
            try {
                boolean startJob = true;
                Configuration conf = new XConfiguration(new StringReader(coordAction.getRunConf()));
                SLAEventBean slaEvent = SLADbOperations.createStatusEvent(coordAction.getSlaXml(), coordAction.getId(), Status.STARTED,
                        SlaAppType.COORDINATOR_ACTION, log);
                if(slaEvent != null) {
                    insertList.add(slaEvent);
                }

                // Normalize workflow appPath here;
                JobUtils.normalizeAppPath(conf.get(OozieClient.USER_NAME), conf.get(OozieClient.GROUP_NAME), conf);
                String wfId = dagEngine.submitJob(conf, startJob);
                coordAction.setStatus(CoordinatorAction.Status.RUNNING);
                coordAction.setExternalId(wfId);
                coordAction.incrementAndGetPending();

                //store.updateCoordinatorAction(coordAction);
                JPAService jpaService = Services.get().get(JPAService.class);
                if (jpaService != null) {
                    log.debug("Updating WF record for WFID :" + wfId + " with parent id: " + actionId);
                    WorkflowJobBean wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(wfId));
                    wfJob.setParentId(actionId);
                    wfJob.setLastModifiedTime(new Date());
                    updateList.add(wfJob);
                    updateList.add(coordAction);
                    try {
                        jpaService.execute(new BulkUpdateInsertForCoordActionStartJPAExecutor(updateList, insertList));
                    }
                    catch (JPAExecutorException je) {
                        throw new CommandException(je);
                    }
                }
                else {
                    log.error(ErrorCode.E0610);
                }

                makeFail = false;
            }
            catch (DagEngineException dee) {
                errMsg = dee.getMessage();
                errCode = dee.getErrorCode().toString();
                log.warn("can not create DagEngine for submitting jobs", dee);
            }
            catch (CommandException ce) {
                errMsg = ce.getMessage();
                errCode = ce.getErrorCode().toString();
                log.warn("command exception occured ", ce);
            }
            catch (java.io.IOException ioe) {
                errMsg = ioe.getMessage();
                errCode = "E1005";
                log.warn("Configuration parse error. read from DB :" + coordAction.getRunConf(), ioe);
            }
            catch (Exception ex) {
                errMsg = ex.getMessage();
                errCode = "E1005";
                log.warn("can not create DagEngine for submitting jobs", ex);
            }
            finally {
                if (makeFail == true) { // No DB exception occurs
                    log.error("Failing the action " + coordAction.getId() + ". Because " + errCode + " : " + errMsg);
                    coordAction.setStatus(CoordinatorAction.Status.FAILED);
                    if (errMsg.length() > 254) { // Because table column size is 255
                        errMsg = errMsg.substring(0, 255);
                    }
                    coordAction.setErrorMessage(errMsg);
                    coordAction.setErrorCode(errCode);

                    updateList = new ArrayList<JsonBean>();
                    updateList.add(coordAction);
                    insertList = new ArrayList<JsonBean>();

                    SLAEventBean slaEvent = SLADbOperations.createStatusEvent(coordAction.getSlaXml(), coordAction.getId(), Status.FAILED,
                            SlaAppType.COORDINATOR_ACTION, log);
                    if(slaEvent != null) {
                        insertList.add(slaEvent); //Update SLA events
                    }
                    try {
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.