Scheduling Weekly Oozie
There is not (in the 3.3.2 source i'm looking at), but there's nothing stopping you from downloading the source and amending the core/java/org/apache/oozie/coord/CoordELEvaluator.java
file, specifically the createURIELEvaluator(String)
method:
public static ELEvaluator createURIELEvaluator(String strDate) throws Exception { ELEvaluator eval = new ELEvaluator(); Calendar date = Calendar.getInstance(DateUtils.getOozieProcessingTimeZone()); // always??? date.setTime(DateUtils.parseDateOozieTZ(strDate)); eval.setVariable("YEAR", date.get(Calendar.YEAR)); eval.setVariable("MONTH", make2Digits(date.get(Calendar.MONTH) + 1)); eval.setVariable("DAY", make2Digits(date.get(Calendar.DAY_OF_MONTH))); eval.setVariable("HOUR", make2Digits(date.get(Calendar.HOUR_OF_DAY))); eval.setVariable("MINUTE", make2Digits(date.get(Calendar.MINUTE))); // add the following line: eval.setVariable("WEEK", make2Digits(date.get(Calendar.WEEK_OF_YEAR))); return eval;}
You should then be able to follow the instructions to recompile oozie
I would note that you should be weary of how week numbers and years don't always fit together nicely - for example week 1 of 2013 actually starts in 2012:
Tue Dec 25 11:11:52 EST 2012 : 2012 W 52Wed Dec 26 11:11:52 EST 2012 : 2012 W 52Thu Dec 27 11:11:52 EST 2012 : 2012 W 52Fri Dec 28 11:11:52 EST 2012 : 2012 W 52Sat Dec 29 11:11:52 EST 2012 : 2012 W 52Sun Dec 30 11:11:52 EST 2012 : 2012 W 1 <= Here's your problemMon Dec 31 11:11:52 EST 2012 : 2012 W 1Tue Jan 01 11:11:52 EST 2013 : 2013 W 1 <= 'Fixed' from hereWed Jan 02 11:11:52 EST 2013 : 2013 W 1Thu Jan 03 11:11:52 EST 2013 : 2013 W 1Fri Jan 04 11:11:52 EST 2013 : 2013 W 1Sat Jan 05 11:11:52 EST 2013 : 2013 W 1Sun Jan 06 11:11:52 EST 2013 : 2013 W 2Mon Jan 07 11:11:52 EST 2013 : 2013 W 2Tue Jan 08 11:11:52 EST 2013 : 2013 W 2
As produced by the following test snippet:
@Testpublic void testDates() { Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.set(2012, 11, 25); for (int x = 0; x < 15; x++) { System.err.println(cal.getTime() + " : " + cal.get(Calendar.YEAR) + " W " + cal.get(Calendar.WEEK_OF_YEAR)); cal.add(Calendar.DAY_OF_YEAR, 1); }}