- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Oozie Workflow: Get running action name
- Labels:
-
Apache Oozie
Created on ‎11-09-2015 11:28 AM - edited ‎09-16-2022 02:48 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
I am trying to fetch the name of the running action in a oozie workflow. I know we can get the workflow level details by using a REST Request as given here.
But i did not have any luck in getting more detailed drilled down info of a workflow.
Can someone please help me out on this ?
Created ‎11-16-2015 09:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do this:
req = urllib2.Request('http://xx.xx.xxx.xx:11000/oozie/v1/job/0000096-151104073848042-oozie-hado-W')
(Or use /jobs to iterate over the list of all WFs, calling /job/ID for each item's id field)
Created ‎11-14-2015 08:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created on ‎11-16-2015 01:32 AM - edited ‎11-16-2015 02:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Harsh.
I have been using the same Job Information as you mentioned. I guess you are referring to the actions in the JSON returned. But actions is coming as empty for all workflows.
Do i need to do something extra to get action level information ?
Edit: By actions i mean the individual actions that we define in the workflow XML. I am using a normal job.properties file as configuration and not a coordinator.
In other words it can mean the access to Job DAG.
Created ‎11-16-2015 08:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It seems to work OK for me, for ex. for my WF ID of "0000000-151116211358117-oozie-oozi-W":
~> curl -L 'http://localhost:11000/oozie/v2/job/0000000-151116211358117-oozie-oozi-W' > wf.json
~> python
>>> import json
>>> a = json.loads(open('wf.json').read())
>>> len(a['actions'])
2
>>> a['actions'][1]['name']
u'Shell'
FWIW, Hue today uses the same API for its Oozie app dashboards, and it does fetch all actions properly too.
How old is the targeted WF, and are you able to see the list of actions OK in the web UIs?
Created ‎11-16-2015 09:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is the sample python code i am using
req = urllib2.Request('http://xx.xx.xxx.xx:11000/oozie/v1/jobs?show=info')
response = urllib2.urlopen(req)
output = response.read()
output1 = json.loads(output)
print output1
Output:
{"status": "RUNNING", "run": 0, "startTime": "Mon, 16 Nov 2015 14:40:29 GMT", "appName": "WrkflowGeneratorDemo", "lastModTime": "Mon, 16 Nov 2015 14:43:08 GMT", "actions": [], "acl": null, "appPath": null, "externalId": null, "consoleUrl": "http://ip-xx-xxx-xx-xx:11000/oozie?job=0000096-151104073848042-oozie-hado-W", "conf": null, "parentId": null, "createdTime": "Mon, 16 Nov 2015 14:40:29 GMT", "toString": "Workflow id[0000096-151104073848042-oozie-hado-W] status[RUNNING]", "endTime": null, "id": "0000096-151104073848042-oozie-hado-W", "group": null, "user": "hadoop"}
In the req, i have tried specifying the len, offset, jobtype and type. But it always gives the same output
Created ‎11-16-2015 09:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do this:
req = urllib2.Request('http://xx.xx.xxx.xx:11000/oozie/v1/job/0000096-151104073848042-oozie-hado-W')
(Or use /jobs to iterate over the list of all WFs, calling /job/ID for each item's id field)
