基于oozie doc我明白我可以使用全局元素来避免重复,比如每个动作的作业跟踪器规范。虽然,给出以下简单的工作流程:
<workflow-app name="Test Hello World" xmlns="uri:oozie:workflow:0.4">
<global>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
</global>
<start to="import"/>
<action name="import">
<shell xmlns="uri:oozie:shell-action:0.1">
<exec>hw.sh</exec>
<file>hw.sh#hw.sh</file>
</shell>
<ok to="end"/>
<error to="kill"/>
</action>
<kill name="kill">
<message>Action failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>
在运行oozie validate
时,我得到:
Error: Invalid app definition, org.xml.sax.SAXParseException; lineNumber: 9; columnNumber: 19; cvc-complex-type.2.4.a: Invalid content was found starting with element 'exec'. One of '{"uri:oozie:shell-action:0.1":job-tracker}' is expected.
所以基本上,它仍然期望行动中的作业跟踪元素。
如果您对此行为有任何疑问,我们将非常感谢您的回答。 谢谢。
答案 0 :(得分:2)
以下是oozie shell action version 0.1
的架构。您会注意到job-tracker
和name-node
标记要求最少出现1次。同样适用于exec
标记。
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:shell="uri:oozie:shell-action:0.1" elementFormDefault="qualified"
targetNamespace="uri:oozie:shell-action:0.1">
<xs:element name="shell" type="shell:ACTION"/>
<xs:complexType name="ACTION">
<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="shell:PREPARE" minOccurs="0" maxOccurs="1"/>
<xs:element name="job-xml" type="xs:string" minOccurs="0" maxOccurs="1"/>
<xs:element name="configuration" type="shell:CONFIGURATION" minOccurs="0" maxOccurs="1"/>
<xs:element name="exec" type="xs:string" minOccurs="1" maxOccurs="1"/>
<xs:element name="argument" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="env-var" 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:element name="capture-output" type="shell:FLAG" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="FLAG"/>
<xs:complexType name="CONFIGURATION">
<xs:sequence>
<xs:element name="property" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="name" minOccurs="1" maxOccurs="1" type="xs:string"/>
<xs:element name="value" minOccurs="1" maxOccurs="1" type="xs:string"/>
<xs:element name="description" minOccurs="0" maxOccurs="1" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="PREPARE">
<xs:sequence>
<xs:element name="delete" type="shell:DELETE" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="mkdir" type="shell:MKDIR" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="DELETE">
<xs:attribute name="path" type="xs:string" use="required"/>
</xs:complexType>
<xs:complexType name="MKDIR">
<xs:attribute name="path" type="xs:string" use="required"/>
</xs:complexType>
</xs:schema>