When a scheduled Demand Plan Server job starts, it will first write back the date and time to the Job Started field, and it will also change the status on the scheduled job to Not Checked. When the scheduled job is finished in the Demand Plan Server, the date and time will be written back to the Writeback done field. The status will still be Not Checked even if the write-back is done from the Demand Plan Server. To update the status to either Failed or Finished, the new database task FORECAST_SCHEDULE_API.Check_Job_Status, that can be scheduled, needs to be executed. It should be scheduled in sequence so that it runs after the specific job has written back. It should run a while after the Demand Plan Server is scheduled to be finished with the job you want to check. Example, if you want to set up a check on the Refresh IPR job that starts every day at 03:00, you then need to measure how long this job usually takes. Let us assume it usually takes 1 hour. Then schedule the Chec_Job_Status to run every day at 05:00. You should add a buffer to make sure the Demand Plan Server is finished to avoid the risk of false alarms.
The Database Task FORECAST_SCHEDULE_API.Check_Job_Status has the parameters:
Forecast Server ID: The Forecast Server ID can be seen in the Demand Plan Server page.
Job ID: The job can be seen in the Demand Plan Server/Scheduling tab.
Earliest Time Limit: The parameter is set in minutes and used to check that the job finish in time. Example: If the scheduled Demand Plan Server job is scheduled to start at 03:00 and it is Writeback Done is normally at 04:00 the database task can be configured to run at 05:00 with the setting 120 minutes. The job will then check that the write-back done is at a later time then 05:00 – 120 minutes, in the above case this check will be true and the status will be set to Finished.
Execution Time Limit: The parameter is set in minutes and is used to check that the job did not take too long to finish. This parameter is optional and it checks the maximum time the job is allowed to take to complete the write-back.
The status will be set to Finished if all the below conditions are true:
(Sysdate - Earliest Time Limit ) < Writeback Done
Job Started < Writeback Done
If Execution time limit is set
(Writeback Done – Job Started) < Execution Time Limit
If any of the above fails, the status on the Demand Plan Server scheduled job will be set to Failed.
A custom event can be configured connected to the database change of the status.