Pentaho Trigger

Pentaho, according to the definition of wikipedia, is open source Business Intelligence suite with integrated reporting, dashboard, data mining, work-flow and ETL. There is no doubt that Pentaho has an excellent ability to produce tables, charts and to analysis data. Sometimes, based on needs of the customers, we have to generate some specific reports at the specified time and what we can do now? Fortunately, with the help of the component called “Trigger” of the Pentaho suite, we can resolve this problem easily and those reports will be generated automatically at those particular time.

There are two types of trigger in the Pentaho:

Simple Trigger: A simple trigger allows a task to be scheduled at a specified regular interval for a specified number of repetitions. The inputs to the simple trigger are the integer values "repeatInterval" (in seconds) and "repeatCount". The trigger will begin firing immediately and continue at the "repeatInterval" for "repeatCount" number of cycles.

Cron Trigger: This trigger uses unix style cron task definitions. The cron trigger takes a "cronString" that represents the trigger definition much like an entry into crontab. The following excerpt from the javadoc for org.quartz.cronTrigger describes the format of the cron expression string.

And now, an example is presented to explain how to configure this component in the existing system.

Step 1: Add an action sequence file and this file can be named by the following format: example-file-job.xaction. And, here, the key word “job” is to indicate that this file is being used to execute the function trigger.

Step 2: Add the following two fragments into this action sequence file:

Fragment 1:

<inputs>   
    <file_solution type="string"> 
      <sources> 
        <request>file_solution</request> 
      </sources>  
      <default-value>name of your solution folder</default-value> 
    </file_solution>  
    <file_path type="string"> 
      <sources> 
        <request>file_path</request> 
      </sources>  
      <default-value>path of your file</default-value> 
    </file_path>  
    <file_action type="string"> 
      <sources> 
        <request>file_action</request> 
      </sources>  
      <default-value>name of the action sequence file which needs to be executed automacticali </default-value> 
    </file_action>  
    <job_name type="string"> 
      <sources> 
        <request>job_name</request> 
      </sources>  
      <default-value>name of this job</default-value> 
    </job_name>  
    <cron type="string"> 
      <sources> 
        <request>cron</request> 
      </sources>  
      <default-value>value of this cron string</default-value> 
    </cron>  
    <trigger_name type="string"> 
      <sources> 
        <request>trigger_name</request> 
      </sources>  
      <default-value>name of this trigger</default-value> 
    </trigger_name>  
  </inputs>

Fragment 2:

<actions> 
    <action-definition> 
      <component-name>JobSchedulerComponent</component-name> 
      <action-type>schedule</action-type> 
      <action-inputs> 
        <triggerName type="string" mapping="trigger_name"/>  
        <cronString type="string" mapping="cron"/>  
        <solution type="string" mapping="file_solution"/>  
        <path type="string" mapping="file_path"/>  
        <action type="string" mapping="file_action"/>  
        <jobName type="string" mapping="job_name"/>  
      </action-inputs> 
      <component-definition/> 
    </action-definition> 
  </actions>

Step 3:
Define your cron string and, normally, the “cronstring” is comprised of 6 or 7 characters based on your needs.
pentaho-trigger.png
The '?' character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'.
The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12".
The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday".
The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45".
The 'L' character is allowed for the day-of-month and day-of-week fields and this character is short-hand for "last".
The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. 
The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month.
The 'C' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "calendar". 

For example:

 <cron type="string"> 
      <sources> 
        <request>cron</request> 
      </sources>  
      <default-value><![CDATA[0 0 12 L * ?]]></default-value> 
 </cron> 

Here, the cron string stands for this action sequence file will be automatically executed at 12 clock on the last day of every month.
When you have finished three steps above and now you can publish this new action sequence file to your BI Server and it will be executed perfectly as we want.

Reference:
http://en.wikipedia.org/wiki/Pentaho
http://wiki.pentaho.com/display/ServerDoc2x/Triggers

Un commentaire

  1. According to this site, “Pentaho, according to the definition of wikipedia, is open source Business Intelligence suite with integrated reporting, dashboard, data mining, work-flow and ETL. There is no doubt that Pentaho has an excellent ability to produce tables, charts and to analysis data.”

    This will really be useful for my presentations and hopefully I’ll be able to get my way around regarding this.

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Captcha *

Ce site utilise Akismet pour réduire les indésirables. En savoir plus sur comment les données de vos commentaires sont utilisées.