Skip to content

Instantly share code, notes, and snippets.

@staticor
Created January 20, 2019 03:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staticor/43bd04c8fbfd14a8557f19a30b0d3340 to your computer and use it in GitHub Desktop.
Save staticor/43bd04c8fbfd14a8557f19a30b0d3340 to your computer and use it in GitHub Desktop.
workflow decision example
<workflow-app xmlns = "uri:oozie:workflow:0.4" name = "simple-Workflow">
<start to = "external_table_exists" />
<decision name = "external_table_exists">
<switch>
<case to = "Create_External_Table">${fs:exists('/test/abc') eq 'false'}
</case>
<default to = "orc_table_exists" />
</switch>
</decision>
<action name = "Create_External_Table">
<hive xmlns = "uri:oozie:hive-action:0.4">
<job-tracker>xyz.com:8088</job-tracker>
<name-node>hdfs://rootname</name-node>
<script>hdfs_path_of_script/external.hive</script>
</hive>
<ok to = "orc_table_exists" />
<error to = "kill_job" />
</action>
<decision name = "orc_table_exists">
<switch>
<case to = "Create_orc_Table">
${fs:exists('/apps/hive/warehouse/orc_table') eq 'false'}</case>
<default to = "Insert_into_Table" />
</switch>
</decision>
<action name = "Create_orc_Table">
<hive xmlns = "uri:oozie:hive-action:0.4">
<job-tracker>xyz.com:8088</job-tracker>
<name-node>hdfs://rootname</name-node>
<script>hdfs_path_of_script/orc.hive</script>
</hive>
<ok to = "Insert_into_Table" />
<error to = "kill_job" />
</action>
<action name = "Insert_into_Table">
<hive xmlns = "uri:oozie:hive-action:0.4">
<job-tracker>xyz.com:8088</job-tracker>
<name-node>hdfs://rootname</name-node>
<script>hdfs_path_of_script/Copydata.hive</script>
<param>database_name</param>
</hive>
<ok to = "end" />
<error to = "kill_job" />
</action>
<kill name = "kill_job">
<message>Job failed</message>
</kill>
<end name = "end" />
</workflow-app>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment