[ 
https://issues.apache.org/jira/browse/OOZIE-2572?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15330710#comment-15330710
 ] 

Satish Subhashrao Saley edited comment on OOZIE-2572 at 6/14/16 10:30 PM:
--------------------------------------------------------------------------

We are unable to see DURATION_MISS for IN_PROCESS job because the times which 
we are comparing have different time units.
I had look at a coord job while it was running:

{code}
{
slaSummaryList: [
{
nominalTime: 1465930800000,
jobStatus: "RUNNING",
expectedEnd: 1465948800000,
appName: "meow",
actualEnd: null,

actualDuration: 55, <==It is in minutes
expectedDuration: 3600000, <== It is in milliseconds

}
{code}

The java script code is doing comparison based on these values
{code}
oozie-sla-table.js

        if (slaSummary.actualDuration != -1 && slaSummary.expectedDuration != 
-1) {
            slaSummary.durDiff = slaSummary.actualDuration - 
slaSummary.expectedDuration;
            if (slaSummary.actualDuration > slaSummary.expectedDuration) {
                slaMisses += "DURATION_MISS, ";
            }
        }
{code}
The comparison happens correctly if job has ended, because we update the time 
in milliseconds and prepare the json string correctly.
{code}
org.apache.oozie.command.sla.SLAJobEventXCommand.processForEnd()
slaCalc.setActualDuration(slaCalc.getActualEnd().getTime() - 
slaCalc.getActualStart().getTime());
{code} 

For the job which is running, we just do comparison in correct time units but 
does not update actualDuration.
We need to change the logic for preparation of json string i.e. simply return 
the actualDuration in milliseconds. 

{code}
 org.apache.oozie.command.sla.SLAJobEventXCommand.processForRunning()

else if (slaCalc.getActualStart() != null && slaCalc.getExpectedDuration() != 
-1) {
                if (System.currentTimeMillis() - 
slaCalc.getActualStart().getTime() > slaCalc.getExpectedDuration()) {
                    slaCalc.setEventStatus(EventStatus.DURATION_MISS);
                    if (shouldAlert(slaCalc)) {
                        queueEvent(new SLACalcStatus(slaCalc));
                    }
                    eventProc += 2;
                }
            }
{code}


{code}
JSONObject org.apache.oozie.sla.SLASummaryBean.toJSONObject(String timeZoneId)

json.put(JsonTags.SLA_SUMMARY_EXPECTED_DURATION, expectedDuration);
if (actualDuration == -1 && expectedDuration != -1 && actualStartTS != null) {
    long currentDur = (new Date().getTime() - actualStartTS.getTime()) / (1000 
* 60);
    json.put(JsonTags.SLA_SUMMARY_ACTUAL_DURATION, currentDur);
}
else {
    json.put(JsonTags.SLA_SUMMARY_ACTUAL_DURATION, actualDuration);
}
{code}


was (Author: satishsaley):
We are unable to see DURATION_MISS for IN_PROCESS job because the times which 
we are comparing have different time units.
I had look at a coord job while it was running:

{code}
{
slaSummaryList: [
{
nominalTime: 1465930800000,
jobStatus: "RUNNING",
expectedEnd: 1465948800000,
appName: "meow",
actualEnd: null,

actualDuration: 55, <==It is in minutes
expectedDuration: 3600000, <== It is in milliseconds

}
{code}

The java script code is doing comparison based on these values
{code}
oozie-sla-table.js

        if (slaSummary.actualDuration != -1 && slaSummary.expectedDuration != 
-1) {
            slaSummary.durDiff = slaSummary.actualDuration - 
slaSummary.expectedDuration;
            if (slaSummary.actualDuration > slaSummary.expectedDuration) {
                slaMisses += "DURATION_MISS, ";
            }
        }
{code}
The comparison happens correctly if job has ended, because we update the time 
in milliseconds and prepare the json string correctly.
{code}
org.apache.oozie.command.sla.SLAJobEventXCommand.processForEnd()
slaCalc.setActualDuration(slaCalc.getActualEnd().getTime() - 
slaCalc.getActualStart().getTime());
{code} 

For the job which is running, we just do comparison in correct time units but 
does not update actualDuration.
We need to change the logic for preparation of json string

{code}
 org.apache.oozie.command.sla.SLAJobEventXCommand.processForRunning()

else if (slaCalc.getActualStart() != null && slaCalc.getExpectedDuration() != 
-1) {
                if (System.currentTimeMillis() - 
slaCalc.getActualStart().getTime() > slaCalc.getExpectedDuration()) {
                    slaCalc.setEventStatus(EventStatus.DURATION_MISS);
                    if (shouldAlert(slaCalc)) {
                        queueEvent(new SLACalcStatus(slaCalc));
                    }
                    eventProc += 2;
                }
            }
{code}


{code}
JSONObject org.apache.oozie.sla.SLASummaryBean.toJSONObject(String timeZoneId)

json.put(JsonTags.SLA_SUMMARY_EXPECTED_DURATION, expectedDuration);
if (actualDuration == -1 && expectedDuration != -1 && actualStartTS != null) {
    long currentDur = (new Date().getTime() - actualStartTS.getTime()) / (1000 
* 60);
    json.put(JsonTags.SLA_SUMMARY_ACTUAL_DURATION, currentDur);
}
else {
    json.put(JsonTags.SLA_SUMMARY_ACTUAL_DURATION, actualDuration);
}
{code}

> SLA DURATION miss not shown when job is running for longer than expected time
> -----------------------------------------------------------------------------
>
>                 Key: OOZIE-2572
>                 URL: https://issues.apache.org/jira/browse/OOZIE-2572
>             Project: Oozie
>          Issue Type: Bug
>            Reporter: Satish Subhashrao Saley
>            Assignee: Satish Subhashrao Saley
>         Attachments: OOZIE-2572-1.patch
>
>
> If job is running for beyond expected duration, Oozie UI is not slowing SLA 
> for duration miss.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to