hive—oozie worflow中的多个hive2操作接收相同的时间戳

hgb9j2n6  于 2021-06-26  发布在  Hive
关注(0)|答案(1)|浏览(271)

我构建了一个有两个hive2操作的工作流,并使用hue运行它。我需要从系统中获取工作流启动时的当前时间,并将其传递给两个操作。这是工作流的结构:

<?xml version="1.0" encoding="UTF-8"?>

<workflow-app xmlns="uri:oozie:workflow:0.5" name="workflow.xml">
    <global>
        <job-tracker>host1:1234</job-tracker>
        <name-node>hdfs://myhost:4312</name-node>
        <configuration> 
            <property> 
                <name>execution_start</name> 
                <value>${timestamp()}</value> 
            </property> 
        </configuration> 
    </global>
    <start to="script1" />
    <action name="script1">
        <hive2 xmlns="uri:oozie:hive2-action:0.2">
            <jdbc-url>jdbc:hive2://myhost:10/default</jdbc-url>
            <script>script1.hql</script>
            <param>execution_start=${execution_start}</param>
        </hive2>
        <ok to="script2" />
        <error to="fail" />
    </action>
    <action name="script2">
        <hive2 xmlns="uri:oozie:hive2-action:0.2">
            <jdbc-url>jdbc:hive2://myhost:10/default</jdbc-url>
            <script>script2.hql</script>
            <param>execution_start=${execution_start}</param>
        </hive2>
        <ok to="end" />
        <error to="fail" />
    </action>
    <kill name="fail">
        <message>Sub workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
    </kill>
    <end name="end" />
</workflow-app>

我需要在两个Hive动作中有相同的时间戳。到目前为止,hue要求输入名为的参数 execution_start .
我也试过: <param>execution_start=${wf:conf('execution_start')}> . 我没有被提示用这个输入参数,但是我在脚本中得到一个空值。
注意 <param>execution_start=${timestamp()}> 工作,但它不做我的工作,因为时间戳将是不同的,在每个行动。

3phpmpom

3phpmpom1#

您可以首先调用一个只返回时间戳的oozie shell操作,捕获第一个操作的输出,并使用 <param>execution_start=${wf:actionData('TimestampShell')}</param>

相关问题