forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: chenxiaoxiong <chenxiaoxiong@huawei.com> Co-committed-by: chenxiaoxiong <chenxiaoxiong@huawei.com>
43 lines
7.1 KiB
HTML
43 lines
7.1 KiB
HTML
<a name="dataartsstudio_01_0494"></a><a name="dataartsstudio_01_0494"></a>
|
|
|
|
<h1 class="topictitle1">Expression Overview</h1>
|
|
<div id="body8662426"><p id="dataartsstudio_01_0494__en-us_topic_0132846495_p8060118">Node parameter values in a <span id="dataartsstudio_01_0494__en-us_topic_0132846495_text45325561857">DataArts Factory</span> job can be dynamically generated based on the running environment by using Expression Language (EL). You can determine whether to execute this node based on the input parameters of the pipeline and the output of the upstream node. EL uses simple arithmetic and logic to calculate and references embedded objects, including job objects and tool objects.</p>
|
|
<ul id="dataartsstudio_01_0494__ul12613261691"><li id="dataartsstudio_01_0494__li16273267910">Job object: provides properties and methods of obtaining the output message, job scheduling plan time, and job execution time of the previous node in a job.</li><li id="dataartsstudio_01_0494__li52720261391">Tool job: Provides methods of operating character strings, time, and JSON. For example, truncating a substring from a string or formatting time.</li></ul>
|
|
<div class="section" id="dataartsstudio_01_0494__en-us_topic_0132846495_section451814342016"><h4 class="sectiontitle">Syntax</h4><p id="dataartsstudio_01_0494__en-us_topic_0132846495_p1639724014181">Expression syntax:</p>
|
|
<pre class="screen" id="dataartsstudio_01_0494__en-us_topic_0132846495_screen15585124841820">#{expr}</pre>
|
|
<p id="dataartsstudio_01_0494__en-us_topic_0132846495_p758081419207">In the preceding information, <span class="parmname" id="dataartsstudio_01_0494__en-us_topic_0132846495_parmname16685913161419"><b>expr</b></span> indicates an expression. <span class="parmvalue" id="dataartsstudio_01_0494__parmvalue03218371031"><b>#</b></span> and <span class="parmvalue" id="dataartsstudio_01_0494__parmvalue1932118378317"><b>{}</b></span> are common operators used in EL, allowing you to access job properties using embedded objects.</p>
|
|
</div>
|
|
<div class="section" id="dataartsstudio_01_0494__en-us_topic_0132846495_section115961325182019"><h4 class="sectiontitle"><strong id="dataartsstudio_01_0494__en-us_topic_0132846495_b8423527061609">Example</strong></h4><p id="dataartsstudio_01_0494__en-us_topic_0132846495_p096514921215">In the <span class="parmname" id="dataartsstudio_01_0494__parmname14405329144515"><b>URL</b></span> parameter of the <span id="dataartsstudio_01_0494__text1340632913456">Rest Client</span> node, use expression <span class="parmvalue" id="dataartsstudio_01_0494__parmvalue1640715291457"><b>tableName=#{JSONUtil.path(Job.getNodeOutput("get_cluster"),"tables[0].table_name")}</b></span>.</p>
|
|
<p id="dataartsstudio_01_0494__en-us_topic_0132846495_p35842215581">Expression description:</p>
|
|
<ol id="dataartsstudio_01_0494__en-us_topic_0132846495_ol19847202119583"><li id="dataartsstudio_01_0494__en-us_topic_0132846495_li19847132155815"><span class="parmvalue" id="dataartsstudio_01_0494__en-us_topic_0132846495_parmvalue4647933203111"><b>Job.getNodeOutput("get_cluster")</b></span> is used to obtain the execution result of the <span class="parmvalue" id="dataartsstudio_01_0494__en-us_topic_0132846495_parmvalue18476210585"><b>get_cluster</b></span> node in the job. The execution result is a JSON character string.</li><li id="dataartsstudio_01_0494__en-us_topic_0132846495_li1566012471586"><span class="parmvalue" id="dataartsstudio_01_0494__en-us_topic_0132846495_parmvalue146124014314"><b>tables[0].table_name</b></span> is used to obtain the value of a field in the JSON character string.</li></ol>
|
|
</div>
|
|
<div class="section" id="dataartsstudio_01_0494__section94321551181"><h4 class="sectiontitle">Debugging Methods</h4><p id="dataartsstudio_01_0494__p18881191514118">You can debug EL expressions using the following methods.</p>
|
|
<p id="dataartsstudio_01_0494__p8444121217105">This section uses the #{DateUtil.now()} expression as an example.</p>
|
|
<ol id="dataartsstudio_01_0494__ol980518311385"><li id="dataartsstudio_01_0494__li156601101296">Use the Kafka Client node.<ul id="dataartsstudio_01_0494__ul193811626144"><li id="dataartsstudio_01_0494__li113819271411">Prerequisites: An MRS cluster with the Kafka component is available.</li><li id="dataartsstudio_01_0494__li17381728145">Method: Select the Kafka Client node, write the EL expression in the data to be sent, and click <strong id="dataartsstudio_01_0494__b165681311491">Test</strong>. Then right-click the node to view the log. The value of the EL expression is printed in the log.<p id="dataartsstudio_01_0494__p39518471614"><span><img id="dataartsstudio_01_0494__image5860051101510" src="en-us_image_0000002234085024.png" title="Click to enlarge" class="imgResize"></span></p>
|
|
<p id="dataartsstudio_01_0494__p101598851610"><span><img id="dataartsstudio_01_0494__image114502218168" src="en-us_image_0000002269204289.png" title="Click to enlarge" class="imgResize"></span></p>
|
|
</li></ul>
|
|
</li><li id="dataartsstudio_01_0494__li1283551190">Use the shell node.<ul id="dataartsstudio_01_0494__ul3483044171619"><li id="dataartsstudio_01_0494__li24831544111614">Prerequisites: An ECS is available.</li><li id="dataartsstudio_01_0494__li948310447167">Method: Create a host connection, print the EL expression using echo, and click <strong id="dataartsstudio_01_0494__b13320124413920">Test</strong>. Then view the log. The value of the EL expression is printed in the log.<p id="dataartsstudio_01_0494__p880144571719"><span><img id="dataartsstudio_01_0494__image18107113415173" src="en-us_image_0000002234244824.png" title="Click to enlarge" class="imgResize"></span></p>
|
|
<p id="dataartsstudio_01_0494__p167315502170"><span><img id="dataartsstudio_01_0494__image873118014183" src="en-us_image_0000002269204293.png" title="Click to enlarge" class="imgResize"></span></p>
|
|
</li></ul>
|
|
</li><li id="dataartsstudio_01_0494__li28907201495">Use the Create OBS node.<p id="dataartsstudio_01_0494__p765610584185"><a name="dataartsstudio_01_0494__li28907201495"></a><a name="li28907201495"></a>If the preceding methods are unavailable, use the Create OBS node and create an OBS path with the value of the EL expression as its name. You can click <strong id="dataartsstudio_01_0494__b16542147498">Test</strong> and go to the OBS console to view the name of the created path.</p>
|
|
<p id="dataartsstudio_01_0494__p106391949091"><span><img id="dataartsstudio_01_0494__image1211902420198" src="en-us_image_0000002269204277.png" title="Click to enlarge" class="imgResize"></span></p>
|
|
<p id="dataartsstudio_01_0494__p6922105952213"></p>
|
|
<p id="dataartsstudio_01_0494__p1089264320205"></p>
|
|
<p id="dataartsstudio_01_0494__p116391949995"><span><img id="dataartsstudio_01_0494__image113261849201918" src="en-us_image_0000002234085036.png" title="Click to enlarge" class="imgResize"></span></p>
|
|
<p id="dataartsstudio_01_0494__p15982144417211"></p>
|
|
</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dataartsstudio_01_0493.html">EL Expression Reference</a></div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script language="JavaScript">
|
|
<!--
|
|
initImageViewer('.imgResize');
|
|
var msg_imageMax = "view original image";
|
|
var msg_imageClose = "close";
|
|
//--></script> |