Jeopardy Detection Cycle

The primary function of Jeopardy is to continuously monitor the plan throughout its lifecycle and generate notifications if the plan deviates from its anticipated timeline.

Types of Detections

Jeopardy identifies various types of detections:

Must Start

Purpose

  • Indicates that a specific milestone or plan item must have started by the current time.

  • If a section's typical earlyStart time is earlier than the current time, Jeopardy considers the section in Jeopardy.

  • Dispatches a Must Start message for a plan item if the section's start milestone ID is 'START' or for a milestone must start message for intermediate milestones.

Notification Message

Message Type Message
MUST_START (For Plan Item) Plan item has exceeded the required start
MUST_START (For Milestone) Milestone {ABC} must have been completed at {Predicted Time}

Duration

TYPICAL_DURATION

  • When a section is not completed before it is typical earlyFinish time, Jeopardy considers the section in Jeopardy

  • Dispatches a TYPICAL_DURATION message for plan item if the section's start milestone ID is 'START' or for a milestone must start message for intermediate milestones.

MAXIMUM_DURATION

  • When a section is not completed before it is maximum earlyFinish time, Jeopardy considers the section in Jeopardy

  • Dispatches a MAXIMUM_DURATION message for plan item if the section's start milestone ID is 'START' or for a milestone must start message for intermediate milestones.

Notification Message

Message Type Message
TYPICAL_DURATION (For Plan Item) Plan item has exceeded its typical duration.
TYPICAL_DURATION (For Milestone) Milestone {ABC} has exceeded its typical duration.
MAX_DURATION (For Plan Item) Plan item has exceeded maximum duration.
MAX_DURATION (For Milestone) Milestone {ABC} has exceeded maximum duration.

Plan Item Timeline

Purpose

For each plan item, Jeopardy monitors the following time lines:

Timeline Description

MUST_START

The plan item must have started before its predicted start time (as explained above).

TYPICAL_PLAN_ITEM_DURATION

The plan item must have been completed before its predicted typical end time.

HAZARD_PLAN_ITEM_DURATION

The plan item must have been completed before its predicted hazard end time.

MAXIMUM_PLAN_ITEM_DURATION

The plan item must have been completed before its predicted maximum end time.

OOS_PLAN_ITEM_DURATION

The plan item must have been completed before its predicted out-of-scope (OOS) end time.

Notification Message

Message Type Message
HAZARD_PLAN_ITEM_DURATION Plan Item has exceeded hazard duration and is in Hazard riskRegion
MAXIMUM_PLAN_ITEM_DURATION Plan Item has exceeded Maximum duration and is in Critical riskRegion
OOS_PLAN_ITEM_DURATION Plan Item has exceeded out-of-scope duration and is in out-of-scope riskRegion

Plan Timeline

Purpose

For each plan, Jeopardy monitors the following time lines:

Timeline Description

TYPICAL_PLAN_DURATION

The plan must have been completed before its predicted typical end time (as explained above).

HAZARD_PLAN_DURATION

The plan must have been completed before its predicted hazard end time.

MAXIMUM_PLAN_DURATION

The plan must have been completed before its predicted maximum end time.

OOS_PLAN_DURATION

The plan must have been completed before its predicted out-of-scope (OOS) end time.

Notification Message

Message Type Message
PLAN_TYPICAL_MESSAGE Plan has exceeded typical duration and is expected to be in Hazard riskRegion in {time remaining to reach hazard}
PLAN_HAZARD_MESSAGE The plan has exceeded hazard duration and is in Hazard riskRegion.
PLAN_MAX_MESSAGE Plan has exceeded Maximum duration and is in Critical riskRegion
PLAN_OOS_MESSAGE Plan has exceeded OOS duration and is in OOS riskRegion

Population Of Time_Window table

Whenever a plan path is computed or recomputed, the following time lines are predicted:

  • EarlyStart and EarlyFinish for every section

  • ExpectedEndTime for every duration type for every plan item

  • ExpectedEndTime for every duration type for the plan.

After these time lines are predicted, Jeopardy inserts an entry for every detection type in the TIME_WINDOW table with the following data:

  • OrderId

  • PlanId

  • PlanItemId -> Populated only if the detection is for a plan item or milestone

  • StartMilestoneId -> Populated only for MUST_START and DURATION types

  • EndMilestoneId -> Populated only for MUST_START and DURATION types

  • TenantID

  • detection_type

  • expected_time -> Refers to the corresponding time for the detection type.

Jeopardy Detection Cycle (JDC)

The Jeopardy detection cycle is a cron job configurable through the jeopardyDetectionCronExpression property.

Properties

Property Name Property Description
jeopardyDetectionCronExpression JDC Cron Schedule
databaseType Database type. Either PostgreSQL or Oracle
numOfOrdersPerCycle Number of orders to process per cycle

Process

  • Check for Jeopardy in Time_Window

    • JDC goes to the database and checks for any jeopardy using the following query, where TIME_OFFSET is the current time and NUMOFROWS refers to the number of orders to be detected per cycle and is configurable via the numOfOrdersPerCycle:

      • PostgreSQL: SELECT * FROM time_window WHERE orderid IN (SELECT DISTINCT orderid FROM time_window WHERE expected_time <= 'TIME_OFFSET' AND status = 0 LIMIT 'NUMOFROWS')

      • Oracle: SELECT * FROM time_window WHERE orderid IN (SELECT DISTINCT orderid FROM time_window WHERE expected_time <= 'TIME_OFFSET' AND status = 0 FETCH FIRST 'NUMOFROWS' ROWS ONLY)

    • If any row is returned from this query, Jeopardy considers that a jeopardy has been detected because the expected_time is before the current time.

    • For every row returned, jeopardy would update the status column to 1, thus marking them as being in process.

  • Depending on the detection type, Jeopardy then dispatches the notification from the database.

  • After a message is dispatched, it would go on to delete the row from the TIME_WINDOW table.

Reset Stuck Jeopardy Cron Job

This exceptional handling or fail-safe job is designed to address situations where a particular Jeopardy Detection Cycle run fails and fails to update the status column back to 0.

Properties

Property Name Property Description
jeopardyEventResetCronExpression Reset Stuck Jeopardy Cron Schedule
jeopardyResetOffsetInSeconds Offset that is used to find the detection tasks that are stuck.

Process

  • This job runs according to the schedule defined in jeopardyEventResetCronExpression.

  • It updates any detection task that has been stuck for the last jeopardyResetOffsetInSeconds seconds and sets the status to 0 by running the following query:

    UPDATE time_window SET status = 0 WHERE lastchangetimestamp <= ?1 AND status = 1

Calculation to find stuck detection task

lastchangetimestamp <= Current_time - jeopardyResetOffsetInSeconds.