184.108.40.206.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:
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:
7.Inside the “Command” text field, enter the following:
chcp 1252 >nul
…where we have:
o“chcp 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.
o“net 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).
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\TIMi\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).
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 (220.127.116.11.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 here:
Actually, Jenkins supports many other ways to automatically starts an Anatella job (in addition to the “build periodically” option). For example, you can start an Anatella Job when: a specific email arrives, a connection to a specific URL happens, a file appears in a directory, etc. For more details on this subject, please refer to the “Jenkins build trigger plugins” list here:
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.
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 18.104.22.168.4. about Jenkins Backup.