# 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

| Properties | Description |
| --- | --- |
| Loop Type | Select a type of loop to be carried out: either For or While.<br><br><br>For: The task or Job is carried out<br>for the defined number of iteration<br><br><br>While: The task or Job is carried<br>until the condition is met. |
| For | <ul> <li> <p> <span>From</span>: 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.</p> </li> <li> <p> <span>To</span>: enter the last instance number                                     which the loop should finish with.</p> </li> <li> <p> <span>Step</span>: enter the step the loop should                                     be incremented of. A step of 2 means every second                                     instance.</p> </li> <li> <p> <span>Values are increasing</span>: select this                                     check box to only allow an increasing sequence. Deselect                                     this check box to only allow a decreasing sequence.</p> </li> </ul> |
| While | <ul> <li> <p> <span>Declaration</span>: enter an expression                                     initiating the loop.</p> </li> <li> <p> <span>Condition</span>: enter the condition that                                     should be met for the loop to end.</p> </li> <li> <p> <span>Iteration</span>: enter the expression                                     showing the operation to be performed at each loop.</p> </li> </ul> |

## Global Variables

| Variables | Description |
| --- | --- |
| Global Variables | ERROR\_MESSAGE: the error message generated by the<br>component when an error occurs. This is an After variable and it returns a string. This<br>variable functions only if the Die on error checkbox is<br>cleared, if the component has this checkbox.<br><br><br>CURRENT\_VALUE: the current value. Only<br>available for a For type loop. This<br>is a Flow variable and it returns an integer.<br><br><br>CURRENT\_ITERATION: the sequence number of<br>the current iteration. This is a Flow variable and it returns an integer.<br><br>A Flow variable functions during the execution of a component<br>while an After variable functions after the execution of the component.<br><br>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<br>it.<br><br>For more information about variables, see [Using contexts and variables](https://help.qlik.com/talend/r/en-US/8.0/studio-user-guide/contexts-and-variables). |

## Usage

| Usage guidance | Description |
| --- | --- |
| **Usage rule** | tLoop is to be used as a start<br>component and can only be used with an iterate connection to the<br>next component. |
| For | <ul> <li> <p> <span>From</span> </p> </li> <li> <p> <span>To</span> </p> </li> <li> <p> <span>Step</span> </p> </li> <li> <p> <span>Values are increasing</span> </p> </li> </ul> |
| While | <ul> <li> <p> <span>Declaration</span> </p> </li> <li> <p> <span>Condition</span> </p> </li> <li> <p> <span>Iteration</span> </p> </li> </ul> |
| Spark Connection | In the Spark<br>Configuration tab in the Run<br>view, define the connection to a given Spark cluster for the whole Job. In<br>addition, since the Job expects its dependent jar files for execution, you must<br>specify the directory in the file system to which these jar files are<br>transferred so that Spark can access these files:<br><br><ul> <li> <div> <span>Yarn mode</span> (Yarn client or Yarn cluster):<ul> <li> <p>When using Google Dataproc, specify a bucket in the                                            <span>Google Storage staging bucket</span>                                        field in the <span>Spark configuration</span>                                        tab.</p> </li> <li> <p>When using HDInsight, specify the blob to be used for Job                                        deployment in the <span>Windows Azure Storage                                            configuration</span> area in the <span>Spark                                            configuration</span> tab.</p> </li> <li>When using Altus, specify the S3 bucket or the Azure                                    Data Lake Storage for Job deployment in the <span>Spark                                        configuration</span> tab.</li> <li> <p>When using on-premises distributions, use                                        the configuration component corresponding to the file system                                        your cluster is using. Typically, this system is HDFS and so                                        use <a href="https://help.qlik.com/talend/r/en-US/8.0/components/hdfs/thdfsconfiguration">tHDFSConfiguration</a>.</p> </li> </ul> </div> </li> <li> <p> <span>Standalone mode</span>: use the                            configuration component corresponding to the file system your cluster is                            using, such as <a href="https://help.qlik.com/talend/r/en-US/8.0/components/hdfs/thdfsconfiguration-properties-for-apache-spark-batch">tHDFSConfiguration Apache Spark Batch</a> or <a href="https://help.qlik.com/talend/r/en-US/8.0/components/amazon-s3/ts3configuration-properties-for-apache-spark-batch">tS3Configuration Apache Spark Batch</a>.</p> <p>If you are using Databricks without any configuration component present                            in your Job, your business data is written directly in DBFS (Databricks                            Filesystem).</p> </li> </ul><br><br>This connection is effective on a per-Job basis. |