Sunday, October 23, 2016

Scheduling based on Events in CMC

Basically events are three types. 
  1. Custom Event
  2. File  event
  3. Scheduled event.    
First we will see what exactly each one is:

Events are like Flags or Check points which can give some information about the events or actions happened on the server.

Custom Event: This can also be called as Manual event. This one has two properties one its name other is its description.

File base Event: We can use this event based on some file placed in any path like say if file is placed in one of the path in the server, based on this action, you can run reports by scheduling. In brief you can say placing some text or any file in a path. Once this action is completed you can run reports.
In Business Perspective, let say all the required tables for reporting got loaded monthly/weekly/daily. Once this load happens place a textfile in a path.
so once the file is placed this event gets triggered.

Scheduling Event: This event is used to run reports or any BI objects sequentially one after the other.This event definition has three actions in it. Those are Success, Failure and Success or Failure.
It makes sense the status of any running objects could be either success, failure.

Now pictorially will see the events creation and their usage.
Creating Events:  Login to the CMC. In the Define section, you can see the Events .
  1.JPG
Click on the Events Icon.the followed screen appears in the window.
2.JPG
Once you click the New Event The Following screen appears.
/wp-content/uploads/2013/01/3_165674.jpg
Here you can make selection on which type of event you are going to create.
Custom Event:
/wp-content/uploads/2013/01/4_165675.jpg
File Event:
/wp-content/uploads/2013/01/5_165677.jpg
Scheduled Event:
/wp-content/uploads/2013/01/6_165678.jpg
Once after creation of the Events.We need to assign the security to the users to use these events.
Do a right click on the event and select the properties and then select the User security as shown below.click on the Add Principles button to add Users and User Groups to access these events.
/wp-content/uploads/2013/01/8_165681.jpg
Once after done with the security.We can use these events to run BI Objects like Reports,Publications etc.
let say you are scheduling a webi report/publication.Do a right click on the report and Select shedule.The followed screeb will appears.
/wp-content/uploads/2013/01/9_165683.jpg
Click on the Events in Navigation pane to view all the events.Now select the event to “Events to wait for” pane.let say you selected custom event to this pane.
And now try to shedule the report with “Run Now” Option.Then you will see the instance status asPending.It is waiting for the event to get triggered.Then
goto the CMC\Events ,Do a right click on the event and select the “Trigger Event” .
Then come back and check the Instance status.the status will be  changed to  “Running”.
In the above screen you can see “Avalable shcedule Events” and ” Events to Trigger on Completion”  here you can select any sheduled event to trigger on. In the same way you can use this triggered event  as  kickoff event for another shedule or Shedules.In this way We control/achieve Sequential shedules aswellas  Parllel Shedules.

the below scenario will not be achieved through BO Events:
Scenario 1 : Let say we want to create file based event with file patterns. File name is appended with date and i want to schedule the report based on that file?
Unfortunately, no.  For File Events, the Event Server just looks for the presence of the file after it has been absent for at least one cycle of the Event Server – it does NOT look at the contents or date stamp of the file and the file must always have the same name.
Scenario 2:
a recurring scheduled job that waits for the file based event to occur, is there a way to receive a failure notification email if the file that the report is waiting for doesn’t arrive on that day.
Let say a webi report scheduled to start at say 9 AM every day when a text file is created on the shared drive. Obviously, I’m using a file based event here to trigger the scheduled job. I have enabled the Notification email setting to receive both the success and failure emails. Since this is a recurring job (scheduled the report to run every day for the next 2 years) the report runs everyday at specified time and looks for the file. If the file arrives in the specified destination the scheduled job runs for that day and send a success notification email.
If the file doesn’t arrive for whatever reason on that day then the scheduled report will not run, but I will not receive a failure email notification either because the report never failed since the expiry date on the report is set to 2 years from today. How do I notify the admins/users so that they know that the report failed to run for that day so that they are not waiting for the report to arrive? My requirement is that when the file doesn’t arrive after certain time on a given day eg:- if the report instance starts at 9 AM and the file doesn’t arrive by 11 AM then I need to send a notification to the users that the report failed to run.

 --Unfortunately we cant do this from BO,but we can make it work using Database logic,see the below workaround:

you can create a report trigger report.
I like using the latter method as you do not need to worry about setting any extra network directory settings. For those of you working in large institutions, I’m sure you will agree on the amount of effort and time it takes to get any sort of extra network access approved.
Outlined below is the steps on creating a report based trigger that will check if an ETL process has completed successfully, then give the dependent scheduled job the go ahead to refresh the report.

Create trigger report

The trigger report is a scheduled report that will succeed only if the daily ETL process executed successfully.

Step 1

Create a table in the database that contains an ETL check flag. This flag will have a value of 1 if the ETL process was successful and 0 if the ETL process failed.

Step 2

Create an ETL check object in the universe
The object will contain a case statement that will either pass or fail the trigger report. The trick here is that the fail case will contain a 1/0 path which causes an error on the query execution, thus failing the report when the report is refreshed.
universe_object
image-993

Make sure you do not press the Validate button as it will give you an error since the 1/0 is technically invalid.

Step 3

Create a trigger report using Web Intelligence that will be based on the ETL check object
query panel
image-994
The result will look like this
report trigger result
image-995

Step 4

Now test to make the report trigger works. You will need to schedule the report 2 times. Once when the ETL flag is good and once when it is bad.
When the ETL flag is bad we will see a fail on the schedule history, otherwise we will see success.
schedule history
image-996

Create a trigger event in CMC

The trigger event is used to tell the scheduled report that it is okay to execute.

Step 1

In the Central Management Console (CMC), go to Events
events cmc
image-997

Step 2

In System Events or a sub folder of System Events, create a new Event
create event
image-998

Step 3

Select Schedule as the Type, and give it the appropriate name and description. Set the Result as Success because we only want the event to trigger when the trigger report is successful. You can either leave the Alerting Enabled checked or unchecked, depending if you want to be notified each time the trigger report was executed successfully.
Note that you’ll need to subscribe to the Alert in order to see the alert each day.
new event properties
image-999
The new trigger event should look like the following
trigger event result
image-1000

Create a scheduled job that will trigger the event

We’ll need to create a scheduled job on the report that will trigger the event when the data threshold has been met.
It is very important that the trigger executes after the dependent report. The reason being that the dependent report will scan for the trigger event and will not execute until it sees the trigger event. The dependent report does not take into account triggers that happen before the dependent report job starts.
For example if we schedule the dependent report job to run at 9am. Any trigger events that happen before 9am will be ignored. It only sees event triggers after 9am.

Step 1

Create a scheduled job for the report trigger. If the dependent report job runs daily at 6am, then we would set the recurrence to daily at any time later than 6am, but something close to 6am like 6:05am.
If we have multiple jobs that depend on the trigger, we can set the report trigger to run at different times of the day (ie: every 2 hours).
In our example we will only be using 1 dependent report, so we will schedule the report trigger once a day at 6:05am.
schedule report trigger1
image-1001

Step 2

On the Events section, set the Report Scheduler Trigger to execute after completion of the report trigger report. If the report fails (because ETL process failed), nothing will happen because the trigger only executes on success. If the report succeeds (because of ETL process passed), the trigger will execute.
schedule report trigger2
image-1002

Schedule the trigger dependent report

We can now schedule the trigger dependent report, which will only execute when it sees the trigger.

Step 1

Create a new scheduled job for the trigger dependent report
schedule trigger dep report
image-1003

Step 2

Set the recurrence to whenever you want it run. In our example we are scheduling our job to run every day at 6am.

Step 3

On the Events section, we need to set the Events to wait for to the Report Scheduler Trigger. This means that the report will not refresh until it sees the trigger.
schedule trigger dep report2
image-1004

Step 4

Test to make sure everything works!
Okay so let’s say it’s 6am and the scheduled job starts. It will remain at the status Pending until it sees the trigger.
schedule pending
image-1005
Now let’s say the report trigger failed, then the job will not execute and remain at status Pending.
schedule failed
image-1006
Now let’s say the report trigger can execute again 1 hour later and is successful, then the trigger will execute and the trigger dependent report will execute.
schedule history
image-996
schedule success

5 comments:

  1. I will recommend anyone looking for Business loan to mr benjamin who helped me with Four Million USD loan to startup my  business and it's was fast When obtaining a loan from them it was surprising at how easy they were to work with.The process was fast and secure. It was definitely a positive experience.Avoid scammers on here and contact mr benjamin On.  247officedept@gmail.com  . WhatsApp...+ 19893943740. if you looking for business loan.

    ReplyDelete
  2. I will recommend anyone looking for Business loan to mr benjamin who helped me with Four Million USD loan to startup my business and it's was fast When obtaining a loan from them it was surprising at how easy they were to work with.The process was fast and secure. It was definitely a positive experience.Avoid scammers on here and contact mr benjamin On. 247officedept@gmail.com . WhatsApp...+ 19893943740. if you looking for business loan.
    event

    ReplyDelete