4.7.9.2.2. Using Jenkins to run Anatella graphs

<< Click to Display Table of Contents >>

Navigation:  4. How to use Anatella? > 4.7. Batch Execution / Anatella command-line > 4.7.9. Running many Anatella graphs at regular interval > 4.7.9.2. Using Jenkins with Anatella >

4.7.9.2.2. Using Jenkins to run Anatella graphs

 

To run an Anatella Graph from Jenkins, the steps are (each step is illustrated using different screenshot just below):
 

1.Click on “New Item” in the top left corner of the “Jenkins” home page      
 

2.Give a name to your “project”
 

3.Select the option “Freestyle Project”
 

4.Click the OK button:

 

ANATEL~1_img188

 
 

5.Scroll to the bottom of the webpage and click on the “Add build step” button
 

6.Select (i.e. click on) the “Execute Windows batch command” option:

 

ANATEL~1_img189

 
 

7.Inside the “Command” text field, enter the following:

 

chcp 1252 >nul
net use Z: \\My_File_Server\public <password> /user:<login>
"c:\soft\TIMiPortable\bin\AnatellaConsole" "d:\weeklyReport.anatella"
IF %ERRORLEVEL%==1 exit 0

 

…where we have:
 

ochcp 1252 >nul”: is an optional command-line.

 

This command allows you to use non-standard characters (e.g. accentuated characters such as é,è,ê,à,ù,etc.) inside the filePath of the Anatella graphs to run.

 

ANATEL~1_img8

1252 is the most common code page (also called “character set”) used by Java programs (Jenkins is a Java program).
The 1252 code page stands for “Latin 1”: it’s the most common code page used in Europe.

 
 

onet use Z: \\My_File_Server\public <password> /user:<login>  is an optional command-line.

 

It happens very often that an Anatella graph must read some data files stored on a remote “central” File Server (typically these data files are stored on a “network” drive that is named “X:” or “Z:”). This situation must be handled in a special way when executing such an Anatella-Graph inside Jenkins.

 

How are created (i.e. “mounted” in technical terms) the network drives? Usually, there exists a windows script (written by your IT department) that “mounts” all the required network drives when you log-in on your computer. This initialization script might typically perform many different tasks, such as:
 

It mounts various network drives on your computer (using the “net use” command).

It initializes different Environmental Variables

It configures different parameters inside various ODBC/OleDB drivers (such as the character encoding of the ODBC drivers).

etc.

 

The Anatella graphs that are executed by Jenkins are each running inside their own “clean” windows session. When Jenkins creates a new “clean” session (to run a new graph), it does not execute any of the “custom initialization scripts” written by your IT department. As a consequence, this means that the network drives (i.e. the drives named “X:” or “Z:”) are not (directly) available. Since some important network drives are missing, it’s very likely that Anatella won’t be able to execute successfully the required data-transformation-graphs. A simple work-around is to add the “net use” command inside the list of commands executed by Jenkins (to manually “mount” the required network drives) before executing your Anatella-graph.

 

In some (extremely unlikely and very rare) situation, this simple work-around might not be enough and you really need to ask to your IT department what’s the exact content of their custom initialization script (that runs when a user logs-in) so that you can reproduce it inside Jenkins.
 

o"c:\soft\TIMiPortable\bin\AnatellaConsole"  is the location of the “Anatella Console” executable.

 

o"d:\weeklyReport.anatella"  is the location of the Anatella graph to run.

 

The last line (i.e. the line that contains “IF %ERRORLEVEL%==1 exit 0”) is required to tell Jenkins that, when the “Error Level” returned by the Anatella engine (after the graph execution) is 1, it actually only means a simple “warning” and it does not mean a critical execution error of the Anatella Graph. Without this line, Jenkins will interpret all simple warnings as critical errors (and this is usually quite bad).

 

ANATEL~1_img191

 
 

8.OPTIONAL (but very common): You can decide to run your graph automatically at regular interval. To activate some periodical run, click the “Build periodically”. To specify when your graphs are running, you need to write a CRON-type string: See the next section (4.7.9.2.3.) for more information about this subject.

If you don’t setup any periodical run, you can still “manually” run your Anatella graphs at anytime through the web interface: Just click on the clock icon ANATEL~1_img192 here:

 

ANATEL~1_img193

 

 

9.OPTIONAL (but very common): You can decide to delete old execution traces (i.e. to delete old log files): Click on the “Discard Old Builds” option and choose some “discarding strategy”.

 

10.Click on the “SAVE” button at the bottom of the webpage.

 

ANATEL~1_img194

 

 
The above procedure is the standard & minimal procedure to schedule the execution of an Anatella Graph using Jenkins. This is just a (very) simple example: Jenkins offers many more options (especially after installing the many extentions & plugins that are available).

 

Once you have finished configuring Jenkins to run all your Anatella graphs, you should backup your Jenkins configuration: See the section 4.7.9.2.4. about Jenkins Backup.