ComposantsComponents

ComposantsComponents › OrchestrationOrchestration

tPrejob

tPrejob

OrchestrationOrchestration

Démarre le pré-job : ce qu'il déclenche s'exécute avant tous les autres sous-jobs du job, quelle que soit leur place sur la grille. C'est l'endroit des préparations : vérifier qu'un dossier existe, ranger des variables globales, écrire un message de début. Starts the prejob: what it triggers runs before all the other subjobs of the job, whatever their place on the canvas. It is the place for preparations: check that a folder exists, store global variables, write a start message.

EntréeInput

aucunenone il commence le pré-jobit starts the prejob

SortieOutput

aucunenone pas de fluxno flow

Déclencheurs en sortieOutput triggers

On Component Ok un seul liena single link

UtilisationUsage

Le pré-jobThe prejob

OnComponentOk OnSubjobOk tPrejob_1 tJava_1 tSetGlobalVar_1

Le tPrejob ne contient pas de code : il sert de point de départ. Le composant qu'il déclenche commence le pré-job ; les sous-jobs qui en découlent (On Subjob Ok, Run if…) en font partie et passent eux aussi avant le reste du job. The tPrejob contains no code: it is a starting point. The component it triggers starts the prejob; the subjobs that follow from it (On Subjob Ok, Run if…) belong to it and also run before the rest of the job.

Ordre d'exécution d'un jobExecution order of a job

  1. le tContextLoad implicite (onglet Job › Extra), s'il est activé ;the implicit tContextLoad (Job › Extra tab), if activated;
  2. le pré-job ;the prejob;
  3. les autres sous-jobs ;the other subjobs;
  4. le post-job (tPostjob).the postjob (tPostjob).

Avec l'exécution multi-thread du job, les autres sous-jobs tournent en parallèle, mais le pré-job passe toujours seul, avant eux. With multi-thread execution of the job, the other subjobs run in parallel, but the prejob always runs alone, before them.

  1. Déposez le tPrejob depuis la famille Orchestration de la palette. Drop the tPrejob from the Orchestration family of the palette.
  2. Reliez-le au premier composant de la préparation : clic droit › Déclencher › On Component Ok. Connect it to the first component of the preparation: right-click › Trigger › On Component Ok.
  3. Enchaînez les autres étapes de la préparation par On Subjob Ok. Les sous-jobs principaux n'ont pas besoin d'être reliés au pré-job. Chain the other preparation steps with On Subjob Ok. The main subjobs do not need to be connected to the prejob.

ParamètresSettings

Le tPrejob n'a aucun paramètre : ni paramètre simple, ni paramètre avancé, ni variable globale. Un job n'accepte qu'un seul tPrejob. The tPrejob has no settings: no basic setting, no advanced setting, no global variable. A job accepts only one tPrejob.

ExemplesExamples

Chaque tJava écrit le message indiqué. Sorties copiées depuis une exécution du job ; dans les erreurs, le nom du job est remplacé par MyJob et les traces d'exception sont abrégées. Each tJava writes the message shown. Outputs copied from a run of the job; in the errors, the job name is replaced with MyJob and the exception traces are shortened.

Ordre d'exécutionExecution order

OnComponentOk OnComponentOk OnSubjobOk tJava_1 "Main subjob: processing" tPostjob_1 tJava_2 "Postjob: closing" tPrejob_1 tJava_3 "Prejob: step 1" tJava_4 "Prejob: step 2"

Les composants ont été déposés dans cet ordre : le sous-job principal d'abord, le tPrejob en dernier. The components were dropped in this order: the main subjob first, the tPrejob last.

Prejob: step 1
Prejob: step 2
Main subjob: processing
Postjob: closing

Une exception dans le pré-job n'arrête pas le jobAn exception in the prejob does not stop the job

OnComponentOk tPrejob_1 tJava_2

tJava_2 lève une exception ; le job a aussi un sous-job principal et un post-job. tJava_2 throws an exception; the job also has a main subjob and a postjob.

if (true) {
    throw new RuntimeException("Prejob failed");
}
Exception in component tJava_2 (MyJob)
java.lang.RuntimeException: Prejob failed
	at …
Main subjob: processing
Postjob: closing

Le job se termine avec le code 1, mais le sous-job principal et le post-job se sont exécutés. The job ends with code 1, but the main subjob and the postjob have run.

Un tDie dans le pré-job non plusNor does a tDie in the prejob

OnComponentOk OnSubjobOk tPrejob_1 tJava_2 tDie_1

tDie_1 : message "Input folder missing", code d'erreur 4. Réglages par défaut : tDie_1: message "Input folder missing", error code 4. Default settings:

Prejob: checking the input folder
Input folder missing
Main subjob: processing
Postjob: closing

Le job continue et se termine avec le code 1. Avec Quitter la JVM immédiatement coché dans le tDie, tout s'arrête là, post-job compris, avec le code 4 : The job goes on and ends with code 1. With Exit the JVM immediately checked in the tDie, everything stops there, postjob included, with code 4:

Prejob: checking the input folder
Input folder missing

ConseilsTips

Arrêter le job quand la préparation échoueStop the job when the preparation fails

Chaque sous-job du job démarre même si le pré-job a échoué. Pour arrêter le job, un tDie avec Quitter la JVM immédiatement ; le post-job ne s'exécute alors pas. Pour garder le post-job, rangez le résultat de la préparation dans une variable globale et faites commencer le sous-job principal par un test (Run if). Each subjob of the job starts even if the prejob failed. To stop the job, a tDie with Exit the JVM immediately; the postjob then does not run. To keep the postjob, store the result of the preparation in a global variable and make the main subjob start with a test (Run if).

Un ordre qui ne dépend pas de la grilleAn order that does not depend on the canvas

Le pré-job passe en premier même déposé en dernier (voir le premier exemple) : la préparation ne dépend ni de la place des sous-jobs sur la grille, ni de l'ordre où ils ont été créés. The prejob runs first even when dropped last (see the first example): the preparation depends neither on the place of the subjobs on the canvas, nor on the order in which they were created.

Les valeurs préparéesThe prepared values

Les variables globales et les variables de contexte changées dans le pré-job valent pour tout le reste du job : c'est le même job, la même exécution. The global variables and the context variables changed in the prejob apply to the whole rest of the job: it is the same job, the same run.

Dans un job enfantIn a child job

Un job lancé par un tRunJob exécute son propre pré-job à chacun de ses lancements. A job started by a tRunJob runs its own prejob at each of its starts.

Voir aussiSee also

D'autres composants de la famille Orchestration : Other components of the Orchestration family: