本Markdown编辑器使用[StackEdit][6]修改而来,用它写博客,将会带来全新的体验哦:
有同事反应,使用oozie编写wf脚本时, 设置retry-max=15(重试次数),并没有生效, 无论设置多少, 都仅仅重试3次.
<workflow-app name="AOF_ETL_JSS_WF" xmlns="uri:oozie:workflow:0.4">
<start to="java-node"/>
<action name="java-node" retry-max="15" retry-interval="5">
....
</action>
<kill name="fail">
<message>shell failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>
日志:
ACTION[0011363-150709161615757-oozie-jd_a-W@:start:] Action user retry max [3] is over system defined max [3], re-assign to use system max.
究其原因为, oozie-site.xml中retry设置为3, 故此action中设置大于3的数值,都默认为3.
oozie 源码:
LiteWorkflowStoreService.java
private static int getUserRetryMax(NodeHandler.Context context) throws WorkflowException {
XLog log = XLog.getLog(LiteWorkflowStoreService.class);
Configuration conf = Services.get().get(ConfigurationService.class).getConf();
int ret = conf.getInt(CONF_USER_RETRY_MAX, 0);
int max = ret;
String userRetryMax = context.getNodeDef().getUserRetryMax();
if (!userRetryMax.equals("null")) {
try {
ret = Integer.parseInt(userRetryMax);
if (ret > max) {
// 如果action重试大于设定最大max,则选择oozie-site.xml的值.
ret = max;
log.warn(ErrorCode.E0820.getTemplate(), ret, max);
}
}
catch (NumberFormatException nfe) {
throw new WorkflowException(ErrorCode.E0700, nfe.getMessage(), nfe);
}
}
else {
ret = 0;
}
return ret;
}