Files
doc-exports/docs/dataartsstudio/umn/dataartsstudio_01_0535.html
chenxiaoxiong f9e2808b7c DataArts UMN 20250810 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: chenxiaoxiong <chenxiaoxiong@huawei.com>
Co-committed-by: chenxiaoxiong <chenxiaoxiong@huawei.com>
2025-09-02 10:44:13 +00:00

133 lines
19 KiB
HTML

<a name="dataartsstudio_01_0535"></a><a name="dataartsstudio_01_0535"></a>
<h1 class="topictitle1">For Each</h1>
<div id="body8662426"><div class="section" id="dataartsstudio_01_0535__en-us_topic_0226360828_section44280035173841"><h4 class="sectiontitle">Functions</h4><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p119386561561">The For Each node specifies a subjob to be executed cyclically and assigns values to variables in a subjob with a dataset.</p>
<div class="note" id="dataartsstudio_01_0535__note1168015412361"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="dataartsstudio_01_0535__p166801446369">When a For Each node is executed once, a specified subjob can be cyclically executed for a maximum of 1,000 times.</p>
<p id="dataartsstudio_01_0535__p291114458145">If DLI SQL is used as a frontend node, the For Each node supports a maximum of 100 subjobs.</p>
</div></div>
</div>
<div class="section" id="dataartsstudio_01_0535__en-us_topic_0226360828_section5516152714271"><h4 class="sectiontitle">Parameters</h4><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p49252448103256"><a href="#dataartsstudio_01_0535__en-us_topic_0226360828_table3764823994826">Table 1</a> describes the parameters of the For Each node.</p>
<div class="tablenoborder"><a name="dataartsstudio_01_0535__en-us_topic_0226360828_table3764823994826"></a><a name="en-us_topic_0226360828_table3764823994826"></a><table cellpadding="4" cellspacing="0" summary="" id="dataartsstudio_01_0535__en-us_topic_0226360828_table3764823994826" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters of the For Each node</caption><thead align="left"><tr id="dataartsstudio_01_0535__en-us_topic_0226360828_row3170822394826"><th align="left" class="cellrowborder" valign="top" width="21.62%" id="mcps1.3.2.3.2.4.1.1"><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p2984581994826">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.92%" id="mcps1.3.2.3.2.4.1.2"><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p159227094826">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="68.46%" id="mcps1.3.2.3.2.4.1.3"><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p6186505494826">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dataartsstudio_01_0535__en-us_topic_0226360828_row1991457694826"><td class="cellrowborder" valign="top" width="21.62%" headers="mcps1.3.2.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p246794194826">Node Name</p>
</td>
<td class="cellrowborder" valign="top" width="9.92%" headers="mcps1.3.2.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p6568554794826">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="68.46%" headers="mcps1.3.2.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p1892909794826">Name of a <span id="dataartsstudio_01_0535__en-us_topic_0099822521_text44323307153939">node</span>. The name must contain 1 to 128 characters, including only letters, numbers, underscores (_), hyphens (-), slashes (/), less-than signs (&lt;), and greater-than signs (&gt;).</p>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0226360828_row3614415394826"><td class="cellrowborder" valign="top" width="21.62%" headers="mcps1.3.2.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p691118102013">Subjob in a Loop</p>
</td>
<td class="cellrowborder" valign="top" width="9.92%" headers="mcps1.3.2.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p19910710907">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="68.46%" headers="mcps1.3.2.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p1490912101503">Name of the subjob to be executed cyclically.</p>
</td>
</tr>
<tr id="dataartsstudio_01_0535__row104029224424"><td class="cellrowborder" valign="top" width="21.62%" headers="mcps1.3.2.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p13402204713396">Subjob Parameter Name</p>
</td>
<td class="cellrowborder" valign="top" width="9.92%" headers="mcps1.3.2.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p13402204712396">No</p>
</td>
<td class="cellrowborder" valign="top" width="68.46%" headers="mcps1.3.2.3.2.4.1.3 "><div class="p" id="dataartsstudio_01_0535__p729428193513">This parameter is available only when you set job parameters for a cyclic subjob. The parameter name is the variable defined in the subjob. Set the parameter value based on the following rules:<ul id="dataartsstudio_01_0535__ul144670159358"><li id="dataartsstudio_01_0535__en-us_topic_0226360828_li18860149124412">If the cyclic subjob needs to be read and replaced based on the variables of the parent job, set this parameter to an EL expression, for example, <strong id="dataartsstudio_01_0535__b101218481861">#{Loop.current[0]}</strong> or <strong id="dataartsstudio_01_0535__b191339536618">#{Loop.current[1]}</strong> which indicates obtaining the first or second value in the current row of the traversed dataset two-dimensional array. For details, see <a href="dataartsstudio_01_0534.html">Loop Embedded Objects</a>. After a job parameter name is configured for the cyclic subjob, the parameter value can be left empty.</li><li id="dataartsstudio_01_0535__en-us_topic_0226360828_li1598942614415">If a cyclic subjob needs to use its own parameter variables, leave this parameter blank. In this case, set values for the parameters of the subjob.</li></ul>
</div>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0226360828_row303485991116"><td class="cellrowborder" valign="top" width="21.62%" headers="mcps1.3.2.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p1290816101701">Dataset</p>
</td>
<td class="cellrowborder" valign="top" width="9.92%" headers="mcps1.3.2.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p690881010014">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="68.46%" headers="mcps1.3.2.3.2.4.1.3 "><div class="p" id="dataartsstudio_01_0535__p9311195617300">The For Each node needs to define a dataset. The dataset is a two-dimensional array used to cyclically replace variables in a subjob. A row of data in the dataset corresponds to a subjob instance. The dataset may come from the following sources:<ul id="dataartsstudio_01_0535__ul989322513306"><li id="dataartsstudio_01_0535__en-us_topic_0226360828_li162481010123711">Output from upstream nodes, such as the select statements of the Hive SQL, DLI SQL, or Spark SQL node, and echo of the shell node. The EL expression <strong id="dataartsstudio_01_0535__b12463751172619">#{Job.getNodeOutput('preNodeName')}</strong> is used, which means the output of the previous node.</li><li id="dataartsstudio_01_0535__en-us_topic_0226360828_li489792803713">A specified array, for example, two-dimensional array <strong id="dataartsstudio_01_0535__b2454827111810">[['001'],['002'],['003']]</strong><div class="note" id="dataartsstudio_01_0535__note560612122120"><span class="notetitle"> NOTE: </span><div class="notebody"><ul id="dataartsstudio_01_0535__ul10545018615"><li id="dataartsstudio_01_0535__li75464183112">To transfer <strong id="dataartsstudio_01_0535__b16328165172917">00</strong> and <strong id="dataartsstudio_01_0535__b145341553142914">01</strong> as numbers, set this parameter to <strong id="dataartsstudio_01_0535__b3528431173012">[["00"],["01"]];[[00],[01]];[['00'],['01']]</strong>.</li><li id="dataartsstudio_01_0535__li185469181115">To transfer <strong id="dataartsstudio_01_0535__b620524219303">00</strong> and <strong id="dataartsstudio_01_0535__b192051542153018">01</strong> as characters, add escape characters, for example, <strong id="dataartsstudio_01_0535__b11992195153220">[["\"00\""],["\"01\""]];[['\'00\''],['\'01\'']]</strong>.</li></ul>
</div></div>
</li></ul>
</div>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0226360828_row178956111811"><td class="cellrowborder" valign="top" width="21.62%" headers="mcps1.3.2.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p990618101011">Concurrent Subjobs</p>
</td>
<td class="cellrowborder" valign="top" width="9.92%" headers="mcps1.3.2.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p890571010011">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="68.46%" headers="mcps1.3.2.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p5348616409">Subjobs generated cyclically can be executed concurrently. You can set the number of concurrent subjobs.</p>
<div class="note" id="dataartsstudio_01_0535__note293174095819"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dataartsstudio_01_0535__p293119401581">If a subjob contains a CDM Job node, set this parameter to 1.</p>
</div></div>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0226360828_row79412423017"><td class="cellrowborder" valign="top" width="21.62%" headers="mcps1.3.2.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p0958421802">Subjob Instance Name Suffix</p>
</td>
<td class="cellrowborder" valign="top" width="9.92%" headers="mcps1.3.2.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p09513421805">No</p>
</td>
<td class="cellrowborder" valign="top" width="68.46%" headers="mcps1.3.2.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0226360828_p984119208427">Name of the subjob generated by For Each: For Each node name + underscore (_) + suffix.</p>
<p id="dataartsstudio_01_0535__en-us_topic_0226360828_p11842122010424">The suffix is configurable. If the suffix is not configured, the suffix increases in ascending order based on the number.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="dataartsstudio_01_0535__en-us_topic_0226360828_table16592383540" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Advanced parameters</caption><thead align="left"><tr id="dataartsstudio_01_0535__en-us_topic_0099822521_row9846111555118"><th align="left" class="cellrowborder" valign="top" width="28.07%" id="mcps1.3.3.2.4.1.1"><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p2846515195115">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.659999999999998%" id="mcps1.3.3.2.4.1.2"><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p108461215185110">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.269999999999996%" id="mcps1.3.3.2.4.1.3"><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p1484719153511">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="dataartsstudio_01_0535__en-us_topic_0099822521_row18847141515512"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p2847181535113">Max. Node Execution Duration</p>
</td>
<td class="cellrowborder" valign="top" width="15.659999999999998%" headers="mcps1.3.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p15847171511512">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="56.269999999999996%" headers="mcps1.3.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p1884761565119">Execution timeout interval for the <span id="dataartsstudio_01_0535__en-us_topic_0099822521_text1344611820218">node</span>. If retry is configured and the execution is not complete within the timeout interval, the <span id="dataartsstudio_01_0535__en-us_topic_0099822521_text8447488212">node</span> will be executed again.</p>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0099822521_row19847181555112"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p12847815125117">Retry upon Failure</p>
</td>
<td class="cellrowborder" valign="top" width="15.659999999999998%" headers="mcps1.3.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p8847161516511">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="56.269999999999996%" headers="mcps1.3.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p684761514516">Whether to re-execute a <span id="dataartsstudio_01_0535__en-us_topic_0099822521_text68471415185118">node</span> if it fails to be executed. Possible values:</p>
<ul id="dataartsstudio_01_0535__en-us_topic_0099822521_ul18479151514"><li id="dataartsstudio_01_0535__en-us_topic_0099822521_li148481915205115"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b692668954">Yes</strong>: The <span id="dataartsstudio_01_0535__en-us_topic_0099822521_text184861512517">node</span> will be re-executed, and the following parameters must be configured:<ul id="dataartsstudio_01_0535__en-us_topic_0099822521_ul284811151511"><li id="dataartsstudio_01_0535__en-us_topic_0099822521_li1927319416429"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b11288652181717">Retry upon Timeout</strong></li><li id="dataartsstudio_01_0535__en-us_topic_0099822521_li1584811515119"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b1150205942">Maximum Retries</strong></li><li id="dataartsstudio_01_0535__en-us_topic_0099822521_li1184841512511"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b910983280">Retry Interval (seconds)</strong></li></ul>
</li><li id="dataartsstudio_01_0535__en-us_topic_0099822521_li1884851535115"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b8133175784614">No</strong>: The <span id="dataartsstudio_01_0535__en-us_topic_0099822521_text5848215145116">node</span> will not be re-executed. This is the default setting.<div class="note" id="dataartsstudio_01_0535__en-us_topic_0099822521_note112261354122511"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p1722635418254">If retry is configured for a job node and the timeout duration is configured, the system allows you to retry a node when the node execution times out.</p>
<p id="dataartsstudio_01_0535__en-us_topic_0099822521_p1690217201682">If a node is not re-executed when it fails upon timeout, you can go to the <strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b14924182735216">Default Configuration</strong> page to modify this policy.</p>
<p id="dataartsstudio_01_0535__en-us_topic_0099822521_p979555414426"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b11436145811174">Retry upon Timeout</strong> is displayed only when <strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b64361558201713">Retry upon Failure</strong> is set to <strong id="dataartsstudio_01_0535__en-us_topic_0099822521_b34366589176">Yes</strong>.</p>
</div></div>
</li></ul>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0099822521_row148481015115110"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p168481315165110">Policy for Handling Subsequent Nodes If the Current Node Fails</p>
</td>
<td class="cellrowborder" valign="top" width="15.659999999999998%" headers="mcps1.3.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p7848181515114">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="56.269999999999996%" headers="mcps1.3.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p1848915165110">Operation that will be performed if the <span id="dataartsstudio_01_0535__en-us_topic_0099822521_text184871517513">node</span> fails to be executed. Possible values:</p>
<ul id="dataartsstudio_01_0535__en-us_topic_0099822521_ul684811155518"><li id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_li867222192212"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_b63511334183">Suspend execution plans of the subsequent nodes</strong>: stops running subsequent nodes. The job instance status is <strong id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_b635117371819">Failed</strong>.</li><li id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_li2533844102858"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_b31833716587">End the current job execution plan</strong>: stops running the current job. The job instance status is <strong id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_b1521193765820">Failed</strong>.</li><li id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_li22804597102858"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_b72771223151916">Go to the next node</strong>: ignores the execution failure of the current node. The job instance status is <strong id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_b1727710236199">Failure ignored</strong>.</li><li id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_li1657745411173"><strong id="dataartsstudio_01_0535__en-us_topic_0099822521_en-us_topic_0099822521_b99581526191817">Suspend the current job execution plan</strong>: If the current job instance is in abnormal state, the subsequent nodes of this node and the subsequent job instances that depend on the current job are in waiting state.</li></ul>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0099822521_row443311414209"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p6433154115208">Enable Dry Run</p>
</td>
<td class="cellrowborder" valign="top" width="15.659999999999998%" headers="mcps1.3.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p134343417207">No</p>
</td>
<td class="cellrowborder" valign="top" width="56.269999999999996%" headers="mcps1.3.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p9477175317207">If you select this option, the node will not be executed, and a success message will be returned.</p>
</td>
</tr>
<tr id="dataartsstudio_01_0535__en-us_topic_0099822521_row127470182515"><td class="cellrowborder" valign="top" width="28.07%" headers="mcps1.3.3.2.4.1.1 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p1027414042510">Task Groups</p>
</td>
<td class="cellrowborder" valign="top" width="15.659999999999998%" headers="mcps1.3.3.2.4.1.2 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p1827419013254">No</p>
</td>
<td class="cellrowborder" valign="top" width="56.269999999999996%" headers="mcps1.3.3.2.4.1.3 "><p id="dataartsstudio_01_0535__en-us_topic_0099822521_p4881175711254">Select a task group. If you select a task group, you can control the maximum number of concurrent nodes in the task group in a fine-grained manner in scenarios where a job contains multiple nodes, a data patching task is ongoing, or a job is rerunning.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dataartsstudio_01_0441.html">Node Reference</a></div>
</div>
</div>