Support Questions
Find answers, ask questions, and share your expertise

How to get status of latest 5 running co-ordinators via command oozie command line?

How to get status of latest 5 running co-ordinators via command oozie command line?

Super Guru

Oozie experts - Can you please let me know if I have more than 15K coordinators running and I would like to know the status of latest 5 coordinators, get more information such as their cordinator IDs etc. then is there any shortcut except for below command?

/usr/bin/oozie jobs --oozie http://<oozie-host>:11000/oozie -jobtype coordinator -len 20000 -filter user=<username>;status=RUNNING 

I'm asking this because I don't want to play with len parameter everytime in above command.

Can we get this from mysql? if we are not using embedded Derby DB? or is there any other easy solution ?

4 REPLIES 4

Re: How to get status of latest 5 running co-ordinators via command oozie command line?

There is always offset as well but in the end I think he always starts with oldest first.

How about piping it into some linux commands, just give it a huge len and do

oozie jobs yada yada yada | tail -n 5 

You can also access the underlying database obviously and order by date and then do a limit 5 afterwards. You could do the same with derby as well.

Re: How to get status of latest 5 running co-ordinators via command oozie command line?

Super Guru

Re: How to get status of latest 5 running co-ordinators via command oozie command line?

Super Guru

Okay so I came across more efficient way.

You can go to oozie database and fetch rows from coord_jobs table.

Good option if you have 20+ thousands of coordinators running and you want to get latest 5 or 10

Re: How to get status of latest 5 running co-ordinators via command oozie command line?

Hi Kuldeep and Ben, from what I see, at least in Oozie-4.2.0, Oozie starts the listing with latest jobs first, like when using "ORDER BY start-time DESC", and there is no need to worry how many jobs have been attempted, 100 or 100k. You need to know the number of jobs only if you need 5 oldest ones. So, the solution is just to use "-len 5" every time, together with any other filtering options. Example (OOZIE_URL defined, line delimiters removed):

$ oozie jobs -len 3
Job ID                                   App Name     Status    User      Group     Started                 Ended
0000012-160803001112187-oozie-oozi-W     pig-wf       SUCCEEDED it1       -         2016-08-15 06:55 GMT    2016-08-15 06:58 GMT
0000011-160803001112187-oozie-oozi-W     pig-wf       KILLED    it1       -         2016-08-15 06:52 GMT    2016-08-15 06:53 GMT
0000010-160803001112187-oozie-oozi-W     pig-wf       SUCCEEDED it1       -         2016-08-15 06:40 GMT    2016-08-15 06:43 GMT