Reading oozie capture-output element using oozie java api
Shell action capture-output
is written as Properties
in action data
field (SshActionExecutor.java:142). This can be accessed via Oozie REST Api.
I did some test with curl and it is there:
curl http://host:11000/oozie/v1/job/job-id?show=info
Response fragment:
{ //(...) "actions": [ { //(...) "data": "#\n#Tue May 15 15:04:48 EEST 2018\nfoo=bar\n" } ]}
This was an action with shell script echo "foo=bar"
.
Since OozieClient
is a wrapper over this API, something like this should work:
WorkflowJob job = oozieClient.getJobInfo("oozie-wf-id");String data = job.getActions().stream() .filter(action -> "shell-5ed8".equals(action.getName())) .map(WorkflowAction::getData) .findFirst().orElse("");Properties actionProperties = new Properties();actionProperties.load(new StringReader(data));