在后续动作中获取 YARN 动作应用 ID

Getting YARN action application ID in subsequent action

我是 运行 OOZIE 工作流,在 map-reduce 操作中只做地图分布式模型拟合。由于有很多映射器,我编写了一个代码,使用 yarn logs -applicationId application_x 编译所有映射器任务的 YARN 日志,其中 application_x 是所有映射任务的父应用程序 ID。现在我想将此摘要作为工作流的一部分,因此我需要动态获取 application_x,这是先前操作的应用程序 ID。有什么办法可以得到这个吗?

我还没有测试过这个,但我想你可以用工作流 EL 函数得到这个:

wf:actionExternalId(String node)

It returns the external Id for an action node, or an empty string if
the action has not being executed or it has not completed yet.

因此在 map reduce 作业完成后的节点中,您应该可以使用类似 L

wf:actionExternalId('mapred-node-name')

我怀疑它会 return job_xxx 而不是 application_xxx,但你可能可以处理好。