4.7.7. Running an Anatella graph from another language (i.e. from Python, Jenkins, Php, Perl, etc.)

<< Click to Display Table of Contents >>

Navigation:  4. How to use Anatella? > 4.7. Batch Execution / Anatella command-line >

4.7.7. Running an Anatella graph from another language (i.e. from Python, Jenkins, Php, Perl, etc.)

 

When running an Anatella graph from another language or from Jenkins, you might want to monitor in “real-time” the correct execution of your graphs. To do so, you want to “have a look” at the content of the Anatella-Log-Window. To send a copy of the log window content back to the calling process, you can:
 

1.Use the “AnatellaConsole” executable (This is the preferred solution): For example:

 

AnatellaConsole.exe mygraph.anatella

 

2.Use the “Anatella” executable with the “-te” option (this is the old, deprecated solution). The “-te” option outputs the content of the log window to the “Standard Error Output” (stderr). For example:

 

Anatella.exe -e mygraph.anatella  -te

 

You can monitor the messages that are passing on the “StdErr” to detect any errors during the execution of your Anatella graph.

 

ANATEL~1_img8

Please note that, the calling process *must* read the characters arriving on the “StdErr”. If the calling process does not read any characters arriving on the “StdErr”, then Anatella stops running, waiting for these characters to be read.

 

If the calling process does not read “fast enough” the characters arriving on the “StdErr”, Anatella will be “blocked” all the time (waiting for the character- buffer to be flushed) and Anatella will thus run at a very low speed.

 

This means that this option can severely impede the speed of the Anatella computations (especially when there are many messages produced inside the log window): Use this option very carefully: Before using this option, I strongly suggest you to do some testing (i.e. measure the computation time).

 

When there are some errors (or warnings) during the Batch Execution of an Anatella Graph, you might want to “have a look” at the description of these errors inside the Anatella-Log-Window (to be able to understand them and fix these errors). Thus, when there are some errors (or warnings), the Anatella-Log-Window can’t suddenly disappear (to allow you to “have a look” at the errors) and thus the Anatella process can’t close as soon as the computations are finished:

 

look-errors

 

This behavior (i.e. the fact that, by default, “Anatella.exe” does not always close immediately after the end of the computations) is annoying when you call Anatella from Jenkins or from another language: i.e. Indeed, when running an Anatella graph from another language (or from Jenkins), you want to be sure that, as soon as the computations are finished, Anatella always closes, so that:
 

…your Python, Php, etc. script can proceed further along.

…Jenkins can report the error to you.

 

There are several ways to guarantee that the Anatella process always closes at the end of the computations, but the easiest & preferred solution is simply to run “AnatellaConsole.exe” (instead of “Anatella.exe”).
 

 

ANATEL~1_img8

Alternatively, here are two other solutions that both guarantee that the “Anatella.exe” process always closes at the end of the computations (Warning: These are “legacy” and “deprecated” solutions: Do no use them!):

1.Use the “-s” option (i.e. the “silent” mode option) on the command-line. Since no Anatella-Log-Window is visible, it’s impossible for you to to “have a look” at the errors, and thus “Anatella.exe” always closes immediately at the end of the computations.

2.Enable the “Always close” parameter inside the “Anatella Global Settings”:

3.ANATEL~1_img145
 

The “Always close” parameter is a computer-wide parameter: It’s global for the whole machine. If different graphs require different behaviors, use the “-s” option.

You can also set programmmaticaly from the command-line (i.e. from Python, Php, etc) the value of the “Always close” parameter: For example, to enable the option, use: “setQuitOnError.exe 1

 

 

If you saw something interesting inside the Anatella-Log-Window, you can always manually uncheck the “Quit when script complete” option inside the “Commands” menu:

 

      ANATEL~1_img146

 

…this will always prevent the Anatella-Log-Window to close (even if the “Always close” parameter is enabled).
 

 

ANATEL~1_img8

Please note that the (legacy&deprecated) “-te” and “-s” options of the “Anatella.exe” process “propagate down” to all the called subgraphs. To illustrate this propagation, let’s look at the following example:

propagation

 

 

 

 

 

 

 

 

 

 

Let’s assume that you executed the following command-line from Jenkins:

Anatella.exe -e Job_B.anatella -s -te

 

“-te” option: This ouputs inside the “Jenkins log” all the log messages emitted from the following data-transformation-graphs: Job_B.anatella, Job_X.anatella, Job_Y.anatella, Job_Z.anatella.

 

“-s” option: This executes the following data-transformation-graphs in “Silent” (i.e. non-blocking) mode: Job_B.anatella, Job_X.anatella, Job_Y.anatella, Job_Z.anatella.

 

A better alternative is to write:

AnatellaConsole.exe Job_B.anatella

This has the exact same effect.