Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting current time in oozie workflow

Tags:

hadoop

oozie

I've a use case where I need to pass the current date from oozie workflow to pig script. I know that I can get the current date from pig, but my condition is different where in I've to pass it from oozie after an action is complete. Any idea how to achieve this?

And also I've a coordinator job, which will execute for every hour. So how to pass the coordinator execution date to the workflow?

like image 649
DMA Avatar asked Feb 13 '14 09:02

DMA


1 Answers

I've to pass it from oozie after an action is complete. Any idea how to achieve this?

You can use Oozie WL Function String timestamp() From the manpage,

It returns the UTC current date and time in W3C format down to the second (YYYY-MM-DDThh:mm:ss.sZ). I.e.: 1997-07-16T19:20:30.45Z

You can use this as a property,

<property>
<name>the_timestamp</name>
<value>${timestamp()}</value>
<property>

Also, if your action is a Shell Action you can echo the time from within the code and use capture-output to use it further.

I don't know how to handle the second query. All I know is the properties file of the co-ordinator is used by the workflow,

like image 148
Suvarna Pattayil Avatar answered Oct 31 '22 13:10

Suvarna Pattayil