July 30, 2023

tLoop – Docs for ESB 7.x

tLoop

Executes a task or a Job automatically, based on a loop

Depending on the Talend
product you are using, this component can be used in one, some or all of the following
Job frameworks:

tLoop Standard properties

These properties are used to configure tLoop running in the Standard Job framework.

The Standard
tLoop component belongs to the Orchestration family.

The component in this framework is available in all Talend
products
.

Basic settings

Loop Type

Select a type of loop to be carried out: either For or While.

For: The task or Job is carried out
for the defined number of iteration

While: The task or Job is carried
until the condition is met.

For

  • From: enter the first instance number
    which the loop should start from. A start instance number of
    2 with a step of 2 means the loop takes on every even number
    instance.

  • To: enter the last instance number
    which the loop should finish with.

  • Step: enter the step the loop should
    be incremented of. A step of 2 means every second
    instance.

  • Values are increasing: select this
    check box to only allow an increasing sequence. Deselect
    this check box to only allow a decreasing sequence.

While

  • Declaration: enter an expression
    initiating the loop.

  • Condition: enter the condition that
    should be met for the loop to end.

  • Iteration: enter the expression
    showing the operation to be performed at each loop.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

CURRENT_VALUE: the current value. Only available for a
For type loop. This is a Flow variable and it returns
an integer.

CURRENT_ITERATION: the sequence number of the current
iteration. This is a Flow variable and it returns an integer.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

tLoop is to be used as a start
component and can only be used with an iterate connection to the
next component.

Connections

Outgoing links (from this component to another):

Row: Iterate.

Trigger: On Subjob Ok; On Subjob
Error; Run if; On Component Ok; On Component Error.

Incoming links (from one component to this one):

Row: Iterate;

Trigger: On Subjob Ok; On Subjob
Error; Run if; On Component Ok; On Component Error; Synchronize;
Parallelize.

For further information regarding connections, see

Talend Studio User
Guide
.

Executing a Job multiple times using a loop

This scenario describes a Job composed of a parent Job and a child Job. The parent Job
implements a loop which executes a child Job five times, with a pause of three seconds
between each two executions.

Procedure

  1. Create a Parent Job, and drop tLoop, tRunJob, and tSleep components to the workspace.
  2. Connect tLoop to tRunJob using a Row > Iterate connection, and connect tRunJob to tSleep using a
    Row > Main
    connection.

    tLoop_1.png

  3. Create a Child Job, and drop tRowGenerator and tLogRow
    components to the workspace.
  4. Connect tRowGenerator to tLogRow using a Row
    > Main connection.

    tLoop_2.png

  5. On the Basic settings view of the tLoop component, choose For loop type and type in the instance number to start from
    (1), to finish with (5) and the
    step (1).

    tLoop_3.png

  6. On the Basic settings view of the tRunJob component, select Child
    Job in the Job field.

    tLoop_4.png

  7. On the Basic settings view of the tSleep component, enter 3 in the
    Pause field.
  8. Double-click tRowGenerator to open the schema
    editor. Then click the plus button to add four new columns:

    • id, to generate sequence numbers

    • firstname, to generate random first names

    • lastname, to generate random last names

    • city, to generate random city names

    For more information about tRowGenerator, see
    tRowGenerator.
    tLoop_5.png

  9. Press F6 to run the
    Parent Job.

    The Child Job will be executed five times with a
    three-second pause between each two executions, displaying random personal
    information on the Run console as configured in
    the tRowGenerator component.

tLoop properties for Apache Spark Batch

These properties are used to configure tLoop running in the Spark Batch Job framework.

The Spark Batch
tLoop component belongs to the Orchestration family.

The component in this framework is available in all subscription-based Talend products with Big Data
and Talend Data Fabric.

Basic settings

Loop Type

Select a type of loop to be carried out: either For or While.

For: The task or Job is carried out
for the defined number of iteration

While: The task or Job is carried
until the condition is met.

For

  • From: enter the first instance number
    which the loop should start from. A start instance number of
    2 with a step of 2 means the loop takes on every even number
    instance.

  • To: enter the last instance number
    which the loop should finish with.

  • Step: enter the step the loop should
    be incremented of. A step of 2 means every second
    instance.

  • Values are increasing: select this
    check box to only allow an increasing sequence. Deselect
    this check box to only allow a decreasing sequence.

While

  • Declaration: enter an expression
    initiating the loop.

  • Condition: enter the condition that
    should be met for the loop to end.

  • Iteration: enter the expression
    showing the operation to be performed at each loop.

Global Variables

Global Variables

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

CURRENT_VALUE: the current value. Only available for a
For type loop. This is a Flow variable and it returns
an integer.

CURRENT_ITERATION: the sequence number of the current
iteration. This is a Flow variable and it returns an integer.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see
Talend Studio

User Guide.

Usage

Usage rule

tLoop is to be used as a start
component and can only be used with an iterate connection to the
next component.

For

From

 

To

 

Step

 

Values are increasing

While

Declaration

 

Condition

 

Iteration

Spark Connection

In the Spark
Configuration
tab in the Run
view, define the connection to a given Spark cluster for the whole Job. In
addition, since the Job expects its dependent jar files for execution, you must
specify the directory in the file system to which these jar files are
transferred so that Spark can access these files:

  • Yarn mode (Yarn client or Yarn cluster):

    • When using Google Dataproc, specify a bucket in the
      Google Storage staging bucket
      field in the Spark configuration
      tab.

    • When using HDInsight, specify the blob to be used for Job
      deployment in the Windows Azure Storage
      configuration
      area in the Spark
      configuration
      tab.

    • When using Altus, specify the S3 bucket or the Azure
      Data Lake Storage for Job deployment in the Spark
      configuration
      tab.
    • When using Qubole, add a
      tS3Configuration to your Job to write
      your actual business data in the S3 system with Qubole. Without
      tS3Configuration, this business data is
      written in the Qubole HDFS system and destroyed once you shut
      down your cluster.
    • When using on-premise
      distributions, use the configuration component corresponding
      to the file system your cluster is using. Typically, this
      system is HDFS and so use tHDFSConfiguration.

  • Standalone mode: use the
    configuration component corresponding to the file system your cluster is
    using, such as tHDFSConfiguration or
    tS3Configuration.

    If you are using Databricks without any configuration component present
    in your Job, your business data is written directly in DBFS (Databricks
    Filesystem).

This connection is effective on a per-Job basis.

Related scenarios

No scenario is available for the Spark Batch version of this component
yet.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x