ComposantsComponents › Logs & ErreursLogs & Errors
Arrête le job en erreur, volontairement. Il envoie d'abord son message (un texte, un code, une priorité) aux tLogCatcher du job, l'écrit sur la sortie d'erreur, puis met fin au job : le code d'erreur devient le code de sortie du job, que lit le script ou l'ordonnanceur qui l'a lancé. Pour signaler sans arrêter, prenez un tWarn.
Stops the job with an error, on purpose. It first sends its message (a text, a code, a priority) to the tLogCatcher components of the job, writes it to the error output, then ends the job: the error code becomes the exit code of the job, read by the script or the scheduler that started it. To report without stopping, take a tWarn.
EntréeInput
Aucune : il peut commencer un sous-job. Sinon un lien Main (arrêt à la première ligne reçue) ou Iterate. None: it can start a subjob. Otherwise one Main link (stops at the first row received) or Iterate link.
SortieOutput
Un lien Main peut être tracé, mais aucune ligne n'y passe : le job s'arrête dans le composant. A Main link can be drawn, but no row goes through it: the job stops in the component.
Condition du Run if : !((Boolean) globalMap.get("tFileExist_1_EXISTS")). Si le fichier manque, le job s'arrête avec le code du tDie ; sinon le tDie n'est pas exécuté et le job continue par les autres liens du tFileExist.
Run if condition: !((Boolean) globalMap.get("tFileExist_1_EXISTS")). If the file is missing, the job stops with the code of the tDie; otherwise the tDie is not run and the job goes on through the other links of the tFileExist.
Dès qu'une ligne arrive au tDie, le job s'arrête. Le message et le code peuvent reprendre ses valeurs : "Bad row: " + row2.id.
As soon as a row reaches the tDie, the job stops. The message and the code can use its values: "Bad row: " + row2.id.
Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. La troisième colonne donne l'onglet du paramètre. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The third column gives the tab of the setting.
| ParamètreSetting | DéfautDefault | OngletTab | Description |
|---|---|---|---|
| Message d'arrêtDie messageMESSAGE | "the end is near" |
SimplesBasic |
Texte du message, expression Java de type String. Il est écrit sur la sortie d'erreur et arrive dans la colonne message du tLogCatcher.
Text of the message, Java expression of type String. It is written to the error output and arrives in the message column of the tLogCatcher.
|
| Code d'erreurError codeCODE | 4 |
SimplesBasic |
Un entier, expression Java de type int, sans guillemets. C'est le code de sortie du job (voir les cas où il ne l'est pas) et la colonne code du tLogCatcher. Ne le laissez pas vide et n'écrivez pas 0 (voir Pièges).
An integer, Java expression of type int, without quotes. It is the exit code of the job (see the cases where it is not) and the code column of the tLogCatcher. Do not leave it empty and do not write 0 (see Pitfalls).
|
| PrioritéPriorityPRIORITY | ErreurError | SimplesBasic |
Gravité du message : Trace (1), Debug (2), Info (3), Avertissement (4), Erreur (5) ou Fatal (6). Le nombre arrive dans la colonne priority du tLogCatcher. Quelle que soit la priorité, le job s'arrête.
Severity of the message: Trace (1), Debug (2), Info (3), Warning (4), Error (5) or Fatal (6). The number arrives in the priority column of the tLogCatcher. Whatever the priority, the job stops.
|
| Quitter la JVM immédiatementExit the JVM immediatelyEXIT_JVM | NonNo | AvancésAdvanced |
Décochée, le tDie lève une exception interne (TDieException) : le job se termine par son chemin normal d'erreur. Cochée, il appelle System.exit(code) : la machine Java s'arrête sur-le-champ, sans rien exécuter d'autre. Voir L'arrêt.
Unchecked, the tDie throws an internal exception (TDieException): the job ends through its normal error path. Checked, it calls System.exit(code): the Java machine stops at once, without running anything else. See The stop.
|
Dans l'ordre : le tDie appelle chaque tLogCatcher qui capte les tDie (son sous-job s'exécute en entier), écrit le message sur la sortie d'erreur, range ses variables globales, puis arrête le job. Ce qui s'exécute encore après dépend de la case Quitter la JVM immédiatement. In order: the tDie calls each tLogCatcher that catches tDie (its subjob runs in full), writes the message to the error output, stores its global variables, then stops the job. What still runs afterwards depends on the Exit the JVM immediately box.
| Après le tDieAfter the tDie | Case décochée (défaut)Box unchecked (default) | Quitter la JVMExit the JVM |
|---|---|---|
| Suite du sous-job, liens On Subjob Ok et On Component OkRest of the subjob, On Subjob Ok and On Component Ok links | non exécutésnot run | non exécutésnot run |
| Liens On Subjob Error et On Component Error du tDieOn Subjob Error and On Component Error links of the tDie | suivisfollowed | non suivisnot followed |
| Sous-job du tPostjobSubjob of the tPostjob | exécutérun | non exécuténot run |
| Code de sortie du jobExit code of the job | le Code d'erreur, sauf si un tPostjob ou un lien d'erreur du tDie a lancé un sous-job : alors 1the Error code, except when a tPostjob or an error link of the tDie started a subjob: then 1 |
le Code d'erreur, toujoursthe Error code, always |
| Job | Code de sortieExit code |
|---|---|
| tDie, réglages par défauttDie, default settings | 4 |
| Code 12, avec un tLogCatcherCode 12, with a tLogCatcher | 12 |
| Code 12, avec un tPostjobCode 12, with a tPostjob | 1 |
| Code 12, tDie — On Subjob Error → tJavaCode 12, tDie — On Subjob Error → tJava | 1 |
| Code 12, tDie — On Component Error → tJavaCode 12, tDie — On Component Error → tJava | 1 |
| Code 12, Quitter la JVM, avec un tPostjobCode 12, Exit the JVM, with a tPostjob | 12 |
| tJava en erreur — On Component Error → tDie de code 12Failing tJava — On Component Error → tDie of code 12 | 12 |
Code 20 + row2.id, première ligne d'id 1Code 20 + row2.id, first row with id 1 | 21 |
| Code 0 | 0 |
| Code 300 | 300 |
Relevés sous Windows, sur le code de sortie du processus Java de chaque job. Pourquoi 1 : le job remet son code d'erreur à zéro avant de lancer le sous-job du tPostjob ou celui d'un lien d'erreur ; il ne lui reste que l'état « en échec », rendu par 1.
Measured on Windows, on the exit code of the Java process of each job. Why 1: the job resets its error code before starting the subjob of the tPostjob or of an error link; only the "failed" state is left, returned as 1.
((String) globalMap.get("tDie_1_DIE_MESSAGES"))
((Integer) globalMap.get("tDie_1_DIE_CODE"))
((Integer) globalMap.get("tDie_1_DIE_PRIORITY"))
Elles ne se lisent que dans ce qui s'exécute encore après l'arrêt : un sous-job relié au tDie par On Subjob Error ou On Component Error, ou celui du tPostjob. Le code généré range aussi le message sous tDie_1_DIE_MESSAGE, au singulier.
They can only be read in what still runs after the stop: a subjob connected to the tDie with On Subjob Error or On Component Error, or the one of the tPostjob. The generated code also stores the message under tDie_1_DIE_MESSAGE, in the singular.
Lu dans le modèle du composant (tDie_main.javajet), sans exécution : quand Log4j est activé dans les propriétés du projet, le tDie écrit tDie_1 - The die message: suivi du message, au niveau ERROR quelle que soit la priorité choisie, puis tDie_1 - Exiting the VM. au niveau FATAL si Quitter la JVM immédiatement est cochée.
Read from the template of the component (tDie_main.javajet), without a run: when Log4j is activated in the project settings, the tDie writes tDie_1 - The die message: followed by the message, at ERROR level whatever the chosen priority, then tDie_1 - Exiting the VM. at FATAL level if Exit the JVM immediately is checked.
Sorties copiées depuis une exécution des jobs, sortie standard et sortie d'erreur mêlées comme dans la console. Le tLogCatcher a douze colonnes ; pour tenir dans la page, un tFilterColumns n'en garde ici que cinq avant le tLogRow en mode Table.
Outputs copied from a run of the jobs, standard output and error output mixed as in the console. The tLogCatcher has twelve columns; to fit in the page, a tFilterColumns keeps only five of them here before the tLogRow in Table mode.
tJava_1 écrit Before tDie, tJava_2 doit écrire After tDie.
tJava_1 writes Before tDie, tJava_2 is meant to write After tDie.
Before tDie the end is near
Le message part sur la sortie d'erreur, sans pile d'appels ni Exception in component. tJava_2 ne s'exécute pas. Code de sortie : 4.
The message goes to the error output, with no stack trace and no Exception in component. tJava_2 does not run. Exit code: 4.
Trois lignes : 1, Paris, 2, Lyon, 3, Nice. Message "Unexpected row: " + row2.id + " " + row2.name, Code 20 + row2.id.
Three rows: 1, Paris, 2, Lyon, 3, Nice. Message "Unexpected row: " + row2.id + " " + row2.name, Code 20 + row2.id.
1|Paris Unexpected row: 1 Paris
Le job s'arrête à la première ligne : les deux autres ne sont pas lues. Code de sortie : 21. The job stops at the first row: the other two are not read. Exit code: 21.
Message "Input file is missing", Code 12, Priorité Erreur. tJava_3 écrit Postjob.
Message "Input file is missing", Code 12, Priority Error. tJava_3 writes Postjob.
Before tDie .--------+----+------+---------------------+----. | tLogRow_1 | |=-------+----+------+---------------------+---=| |priority|type|origin|message |code| |=-------+----+------+---------------------+---=| |5 |tDie|tDie_1|Input file is missing|12 | '--------+----+------+---------------------+----' Input file is missing Postjob
Le tLogCatcher reçoit le message avant l'arrêt, puis le tPostjob s'exécute. Code de sortie : 1, et non 12, à cause du tPostjob. Le même job sans tPostjob sort avec 12. The tLogCatcher receives the message before the stop, then the tPostjob runs. Exit code: 1, not 12, because of the tPostjob. The same job without a tPostjob exits with 12.
Le job précédent, case cochée : The previous job, box checked:
Before tDie .--------+----+------+---------------------+----. | tLogRow_1 | |=-------+----+------+---------------------+---=| |priority|type|origin|message |code| |=-------+----+------+---------------------+---=| |5 |tDie|tDie_1|Input file is missing|12 | '--------+----+------+---------------------+----' Input file is missing
Le tLogCatcher est encore servi, mais le tPostjob ne s'exécute plus. Code de sortie : 12. The tLogCatcher is still served, but the tPostjob no longer runs. Exit code: 12.
Case décochée, code 12. Le tJava écrit On Subjob Error puis les variables globales :
Box unchecked, code 12. The tJava writes On Subjob Error then the global variables:
Input file is missing On Subjob Error DIE_MESSAGES = Input file is missing DIE_CODE = 12 DIE_PRIORITY = 5
Code de sortie : 1. Même sortie et même code avec On Component Error. Exit code: 1. Same output and same code with On Component Error.
Le code est recopié tel quel dans le code Java. Vide, le job ne compile pas (message abrégé ; le nom du job est remplacé par MyJob) :
The code is copied as is into the Java code. Empty, the job does not compile (shortened message; the job name is replaced with MyJob):
MyJob.java:398: error: no suitable constructor found for Integer(no arguments)
errorCode = new Integer();
^
nullnull message
Le mot null écrit à la place du message ne compile pas non plus (le tWarn, lui, l'accepte) :
The word null written instead of the message does not compile either (the tWarn does accept it):
MyJob.java:427: error: reference to println is ambiguous System.err.println(null); ^ both method println(char[]) in PrintStream and method println(String) in PrintStream match
Dès qu'un job a un tPostjob, ou qu'un sous-job est relié au tDie par un lien d'erreur, le job sort avec 1 quel que soit le Code d'erreur. Si l'ordonnanceur distingue les codes, cochez Quitter la JVM immédiatement et faites le ménage avant le tDie plutôt que dans le tPostjob, qui ne s'exécutera pas.
As soon as a job has a tPostjob, or a subjob is connected to the tDie with an error link, the job exits with 1 whatever the Error code. If the scheduler tells the codes apart, check Exit the JVM immediately and clean up before the tDie rather than in the tPostjob, which will not run.
Avec 0, le job s'arrête bien et son message part sur la sortie d'erreur, mais le code de sortie est 0 : le script qui l'a lancé le croit réussi.
With 0, the job does stop and its message goes to the error output, but the exit code is 0: the script that started it believes it succeeded.
Un job enfant arrêté par un tDie de code 5, lancé par un tRunJob aux réglages par défaut : le tLogCatcher de l'enfant reçoit le tDie ; dans le parent, le tRunJob échoue (java.lang.RuntimeException: Child job running failed.), le tLogCatcher du parent reçoit cette exception, de type Java Exception et d'origine tRunJob_1, et le parent sort avec le code 5. Avec Quitter la JVM immédiatement, System.exit arrête toute la machine Java : le parent aussi quand l'enfant tourne dans la sienne (cas non exécuté pour cette page).
A child job stopped by a tDie of code 5, started by a tRunJob with default settings: the tLogCatcher of the child receives the tDie; in the parent, the tRunJob fails (java.lang.RuntimeException: Child job running failed.), the tLogCatcher of the parent receives that exception, of type Java Exception and origin tRunJob_1, and the parent exits with code 5. With Exit the JVM immediately, System.exit stops the whole Java machine: the parent too when the child runs in the same one (case not run for this page).
Sous Windows, un code 300 est rendu tel quel. Sous Linux et macOS, un code de sortie tient sur un octet : seul le reste de la division par 256 parvient à l'appelant (non exécuté pour cette page). Restez entre 1 et 255. On Windows, a code 300 is returned as is. On Linux and macOS, an exit code fits in one byte: only the remainder of the division by 256 reaches the caller (not run for this page). Stay between 1 and 255.
Une exception non prévue fait sortir le job avec 1. Gardez ce code pour elle et donnez aux tDie des codes à partir de 2, un par cause (fichier absent, table vide, contrôle en échec…) : le code de sortie suffit alors à savoir pourquoi le job s'est arrêté.
An unexpected exception makes the job exit with 1. Keep that code for it and give the tDie components codes from 2 upwards, one per cause (missing file, empty table, failed check…): the exit code is then enough to know why the job stopped.
Reliez un composant fragile à un tDie par On Component Error et reprenez son erreur dans le message : "Load failed: " + globalMap.get("tDBOutput_1_ERROR_MESSAGE"). Vérifié avec un tJava en erreur : le tLogCatcher reçoit le tDie puis l'exception, et le job sort avec le code du tDie (12 dans l'essai), que le lien soit On Component Error ou On Subjob Error.
Connect a fragile component to a tDie with On Component Error and use its error in the message: "Load failed: " + globalMap.get("tDBOutput_1_ERROR_MESSAGE"). Checked with a failing tJava: the tLogCatcher receives the tDie then the exception, and the job exits with the code of the tDie (12 in the test), whether the link is On Component Error or On Subjob Error.
tLogCatcher · reçoit le message avant l'arrêtreceives the message before the stoptWarn · le même message, sans arrêter le jobthe same message, without stopping the jobtPostjob · ce qui s'exécute encore après l'arrêtwhat still runs after the stoptRunJob · le code de retour d'un job enfantthe return code of a child jobtFileExist · la condition de l'exemple d'utilisationthe condition of the usage exampletAssert · vérifier une condition sans arrêter le jobcheck a condition without stopping the job