Tuesday, 15 May 2012

hadoop - Killing an Oozie workflow from java -


So I'm playing with the OZI Java API, as long as I can not stop the following problem. When trying to run the following Java code:

  OozieClient oc = new OozieClient (OOZIE_URL); Properties Conf = oc.create Configuration (); Conf.setProperty (OozieClient.APP_PATH, PATH_TO_WF); String job id = oc.run (conf); While (oakbybinfo (johid) .getStatus () == Workfljob.stats.prep) {Thread.Sleep (1000); } Oc.kill (JobID);  

This fails with the following exception:

  E0508: User [?] Is not authorized for the WF job [JOB_ID_GOES_HERE]  

I have been able to find some related issues on Google, however the people who saw me were only related to the command line OOZI client.

My main question is that you can run Oozie workflow just by adding another user as Java:

  conf.setProperty ("user.name", "user123 ");  

Is there anything that can be done with killing the workflow?

Use AuthOozieClient and set system user.

OozieClient oc = New AuthOozieClient (OOZIE_URL); System.setProperty ("user.name", userName); Client.kill (jobId);

No comments:

Post a Comment