簡體   English   中英

Hadoop Oozie Workflow沒有獲得協調器屬性

[英]Hadoop Oozie Workflow not getting Coordinator properties

我有一個簡單的Oozie協調員和工作流程。 我試圖按如下所述將協調器的dataIn屬性傳遞給工作流: https ://oozie.apache.org/docs/3.2.0-incubating/CoordinatorFunctionalSpec.html#a6.7.1._coord:dataInString_name_EL_Function

由於某些原因,在以下示例中,該值在工作流屬性中為空,而EL變量為空${inputDir}

實際錯誤是: variable [inputDir] cannot be resolved

設定檔

coordinator.xml

<?xml version="1.0" encoding="UTF-8"?>
<coordinator-app xmlns="uri:oozie:coordinator:0.4" name="awesome" frequency="${coord:days(1)}" start="2014-10-06T00:01Z" end="2050-01-01T00:01Z" timezone="UTC">
  <controls>
    <!-- Wait 23 hours before giving up -->
    <timeout>1380</timeout>
    <concurrency>1</concurrency>
    <execution>LIFO</execution>
  </controls>
  <datasets>
    <dataset name="itsready" frequency="${coord:days(1)}" initial-instance="2014-10-06T08:00Z" timezone="America/Los_Angeles">
      <uri-template>${s3DataPath}/${YEAR}-${MONTH}-${DAY}</uri-template>
      <!-- with the done-flag set to none, this will look for the folder's existance -->
      <done-flag></done-flag>
    </dataset>
    <!-- output dataset -->
    <dataset name="itsdone" frequency="${coord:days(1)}" initial-instance="2014-10-06T08:00Z" timezone="America/Los_Angeles">
      <uri-template>${dataPath}/awesome/sql-schema-tab-delim-load/${YEAR}-${MONTH}-${DAY}/loaded</uri-template>
    </dataset>
  </datasets>
  <input-events>
    <data-in name="input" dataset="itsready">
      <instance>${coord:current(0)}</instance>
    </data-in>
  </input-events>
  <output-events>
    <data-out name="output" dataset="itsdone">
      <instance>${coord:current(0)}</instance>
    </data-out>
  </output-events>
  <action>
    <workflow>
      <app-path>${workflowApplicationPath}</app-path>
      <configuration>
        <property>
          <name>inputDir</name>
          <value>${coord:dataIn('input')}</value>
        </property>
      </configuration>
    </workflow>
  </action>
</coordinator-app>

工作流程

<?xml version="1.0" encoding="UTF-8"?>
<workflow-app xmlns="uri:oozie:workflow:0.4" name="awesome-wf">
  <start to="shell-import"/>
  <action name="shell-import">
    <shell xmlns="uri:oozie:shell-action:0.2">
      <job-tracker>${jobTracker}</job-tracker>
      <name-node>${nameNode}</name-node>
      <exec>${importFile}</exec>
      <env-var>INPUT_DIR=${inputDir}</env-var>
      <file>${importFile}#${importFile}</file>
    </shell>
    <ok to="end"/>
    <error to="fail"/>
  </action>
  <kill name="fail">
    <message>it failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
  </kill>
  <end name="end"/>
</workflow-app>

job.properties

hadoopMaster=myawesome.server.com
nameNode=hdfs://${hadoopMaster}:8020
jobTracker=${hadoopMaster}:8050
tzOffset=-8
oozie.use.system.libpath=true
oozie.libpath=/user/oozie/share/lib
appPath=${nameNode}/apps
dataPath=${appPath}/data
s3DataPath=s3n://an/awesome/s3/data/path

oozie.wf.action.notification.url=https://zapier.com/mysecreturl
workflowApplicationPath=${appPath}/awesome

#uncomment both of these lines to test the workflow
#inputDir=s3://awesome/path/2014-10-06
#oozie.wf.application.path=${workflowApplicationPath}

oozie.coord.application.path=${workflowApplicationPath}


importFile=import.sh

要點如下: https : //gist.github.com/nathantsoi/dc8caac7109a57c99399#file-awesome-oozie-config-md

終於有機會重溫了這一點。 它現在正在運行,但是可能由於多種原因。 為了后代,這是我更改的內容:

  • 刪除了空的完成標志
  • 使用dataOut代替dataIn
  • 添加了另一個dataOut事件,為每個事件賦予唯一的名稱

需要進行一些調試才能確定確切原因。

這很容易回答:協調員的開始時間為2014-10-06T00:01Z,而數據集的初始實例為2014-10-06T08:00Z。 因此$ {coord:current(0)}無法為協調程序的第一次運行返回有效的數據集。

似乎您只在運行工作流,而不在運行協調器。

如果您希望協調器填寫這些參數-您需要運行協調器-當數據准備就緒時,它將運行工作流程

可能有兩種可能性:

  1. 而不是在uri模板$ {s3DataPath} / $ {YEAR}-$ {MONTH}-$ {DAY}中使用$ {YEAR}-$ {MONTH}-$ {DAY},請嘗試使用hdfs的完整路徑對值進行硬編碼路徑(例如hdfs:// namenode:8020 / user / data / s3DataPath / 2012-10-10),然后檢查EL函數是否正確替換了日期格式。 如果沒有,請檢查格式化程序以正確定義它。

2.它可能具有與輸入相同的值$ {coord:current(0)}。 因此,嘗試使其變為$ {coord:current(1)}。

可能會有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM