Search in sources :

Example 1 with SLAEvent

use of org.apache.oozie.client.event.SLAEvent in project oozie by apache.

the class LogUtils method setLogPrefix.

public static XLog setLogPrefix(XLog logObj, Event event) {
    String jobId = null, actionId = null, appName = null;
    if (event instanceof JobEvent) {
        JobEvent je = (JobEvent) event;
        if (je.getAppType() == AppType.WORKFLOW_JOB || je.getAppType() == AppType.COORDINATOR_JOB || je.getAppType() == AppType.BUNDLE_JOB) {
            jobId = je.getId();
        } else {
            actionId = je.getId();
            jobId = Services.get().get(UUIDService.class).getId(actionId);
        }
        appName = je.getAppName();
    } else if (event instanceof SLAEvent) {
        SLAEvent se = (SLAEvent) event;
        if (se.getAppType() == AppType.WORKFLOW_JOB || se.getAppType() == AppType.COORDINATOR_JOB || se.getAppType() == AppType.BUNDLE_JOB) {
            jobId = se.getId();
        } else {
            actionId = se.getId();
            jobId = Services.get().get(UUIDService.class).getId(actionId);
        }
        appName = se.getAppName();
    }
    return LogUtils.setLogInfo(logObj, jobId, actionId, appName);
}
Also used : JobEvent(org.apache.oozie.client.event.JobEvent) SLAEvent(org.apache.oozie.client.event.SLAEvent) UUIDService(org.apache.oozie.service.UUIDService)

Aggregations

JobEvent (org.apache.oozie.client.event.JobEvent)1 SLAEvent (org.apache.oozie.client.event.SLAEvent)1 UUIDService (org.apache.oozie.service.UUIDService)1