AlertTaskManager

AlertTaskManager orchestrates the status checks of KPIs created by the Limits Module.

When a breach or warning is detected, an alert*.csv file is generated, which then populates the Alerts Definition Store. For details on the alert.csv file, see Alert file

AlertTaskManager automatically schedules future evaluations for kpi’s which contain limit definitions with an Intraday polling frequency. Intraday polling frequency is configured via the prop values sample-rate-minutes and sample-rate-seconds

##Properties

Property Value Description
task-scheduler-thread-pool-size 4 Thread pool size for task scheduler
sample-rate-minutes * Minute rate for Intraday Alert task’s cron job
sample-rate-seconds 0 Seconds rate for Intraday Alert task’s cron job

TaskScheduler

The TaskScheduler Bean allows you to schedule AlertTasks and can be found in the ThreadPoolTaskSchedulerConfig.java class.

The quantity of threads allotted to the TaskScheduler can be configured with the task-scheduler-thread-pool-size property value. The default value is 4 threads.

The AlertTaskManager maintains a Hashmap of futureAlertTasks which are keyed on KpiTaskKey’s which contain fields for serverName, cubeName, kpiName, and pollingFrequency.

When AlertTaskManager are scheduled, they are added to the futureAlertTasks map. This allows us to unschedule tasks if needed.

REST

Evaluation REST endpoints are available for:

  • On-Demand KPI Evaluation.
  • Unschedule tasks from the TaskScheduler.

On-Demand KPI Evaluation

To start the KPI evaluation against the business cubes, use the following REST endpoint:

Endpoint: http://localhost:3090/limits/rest/v1/limitEvaluation Method: Post Example Endpoint: http://localhost:3090/limits/rest/v1/limitEvaluation/evaluate Example:

{
    "kpiName":"SA Book Limit",
    "cubeName":"StandardisedApproachCube",
    "serverName":"FRTB"
}

The Response sent back will contain Breach and Warning data written to breach and warning alert*.csv files: The generated files will update AlertsDefinition datastore on a listening topic, and updates the Limits workflow status to BREACH and WARNING accordingly.

Example Response:

{
    "status": "success",
    "data": [
        "ID,Name,From,To,PollingFrequency,CCY,Scope,BreachOrWarning,MeasureValue,KpiType,LimitValues,LevelMember,CubeName,ServerName,MDX,BreachCount,LastUpdateTimestamp,LimitSessionID,key",
        "id_252394,SA Book Limit,2018-09-28,,INTRADAY,USD,Book@Books@Booking=BS_MGT_FX,Breach,2751620.5866622548,Greater Than,300000.0,Book@Books@Booking=BS_MGT_FX,StandardisedApproachCube,FRTB,\"SELECT NON EMPTY { [Measures].[SA Book Limit Status], [Measures].[FX Risk Charge] } ON COLUMNS, NON EMPTY Hierarchize( Descendants( { [Booking].[Books].[AllMember] }, 1, SELF_AND_BEFORE ) ) ON ROWS  FROM (   SELECT [Booking].[Books].[AllMember].[BS_MGT_FX] ON COLUMNS   FROM [StandardisedApproachCube]  ) WHERE [Dates].[Date].[2018-09-28]\",1,2022-09-01T10-39-21-551-0400,cfb0f250-dac3-44b2-af48-a2f2bf0e4afe,-952155168",
        "id_252394,SA Book Limit,2018-09-28,,INTRADAY,USD,Book@Books@Booking=CM_OILGAS,Breach,935632.536,Greater Than,100000.0,Book@Books@Booking=CM_OILGAS,StandardisedApproachCube,FRTB,\"SELECT NON EMPTY { [Measures].[SA Book Limit Status], [Measures].[FX Risk Charge] } ON COLUMNS, NON EMPTY Hierarchize( Descendants( { [Booking].[Books].[AllMember] }, 1, SELF_AND_BEFORE ) ) ON ROWS  FROM (   SELECT [Booking].[Books].[AllMember].[CM_OILGAS] ON COLUMNS   FROM [StandardisedApproachCube]  ) WHERE [Dates].[Date].[2018-09-28]\",1,2022-09-01T10-39-21-551-0400,cfb0f250-dac3-44b2-af48-a2f2bf0e4afe,-952153246"
    ]
}

Unschedule tasks from the TaskScheduler

To unschedule a task from the AlertTaskManager use the following REST endpoint:

Endpoint: /limits/rest/v1/limitEvaluation/unschedule Method: POST Example Endpoint: http://localhost:3090/limits/v1/rest/limitEvaluation/unschedule

Example Body:

{
   "serverName":"FRTB",
   "cubeName":"StandardisedApproachCube",
   "kpiName":"SA Book Limit",
   "pollingFrequency":"INTRADAY"
}

Example Response:

{
  "response": "Successfully processed unscheduling task with key : 2018-09-28Equity Desk Hardid_252394Value-at-Risk Portfolio Limit2018-03-012021-03-31OFFICIALEODAPPROVEDUSD2000DeltaDesk=BondsSheila from Risk ControlSensitivity Cube"
}