是否有必要在oozie动作内容中保持一定的顺序?

时间:2013-11-11 11:39:54

标签: hadoop hive oozie

当我尝试使用以下代码运行oozie hive操作时

<action name="Hive-Node">
    <hive xmlns="uri:oozie:hive-action:0.2">
        <job-tracker>${jobTracker}</job-tracker>
        <name-node>${nameNode}</name-node>
        <job-xml>hive-site.xml</job-xml>
        <prepare>
            <mkdir path="${nameNode}/hive/output"/>
        </prepare>
        <configuration>
            <property>
                <name>mapred.job.queue.name</name>
                <value>${queueName}</value>
            </property>
            <property>
                <name>hive.insert.into.multilevel.dirs</name>
                <value>true</value>
            </property>
            <property>
                <name>hbase.zookeeper.quorum</name>
                <value>${hbaseZooQuorum}</value>
            </property>
        </configuration>
        <script>${HIVE_QUERY_FILE}</script>
    </hive>
    <ok to="End" />
    <error to="Fail" />
</action>

我收到以下错误:

Error: E0701 : E0701: XML schema error, cvc-complex-type.2.4.a: Invalid content was found starting with element 'prepare'. One of '{"uri:oozie:hive-action:0.2":configuration, "uri:oozie:hive-action:0.2":script}' is expected.

但在我修改了hive动作中声明标签的顺序,即在<job-xml>...</job-xml>之后移动了<prepare>...</prepare>之后,它运行正常。

是否有必要在oozie行动中遵循这些命令?

1 个答案:

答案 0 :(得分:4)

来自Oozie Hive Action Documentation

架构使用,

<xs:sequence>
    <xs:element name="job-tracker" type="xs:string" minOccurs="1" maxOccurs="1"/>
    <xs:element name="name-node" type="xs:string" minOccurs="1" maxOccurs="1"/>
    <xs:element name="prepare" type="hive:PREPARE" minOccurs="0" maxOccurs="1"/>
    <xs:element name="job-xml" type="xs:string" minOccurs="0" maxOccurs="1"/>
    <xs:element name="configuration" type="hive:CONFIGURATION" minOccurs="0" maxOccurs="1"/>
    <xs:element name="script" type="xs:string" minOccurs="1" maxOccurs="1"/>
    <xs:element name="param" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="file" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="archive" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>

元素xs:sequence as per W3Schools

  

序列元素指定必须出现子元素   序列。每个子元素可以从0到任意数量出现   次。

我们可以根据Hive-Action <prepare>的模式在<job-xml>之前按顺序看到