public class CoordELFunctions extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONFIGURATION |
static String |
COORD_ACTION |
static String |
DATASET |
static long |
DAY_MSEC |
static String |
DIR_SEPARATOR |
static long |
HOUR_MSEC |
static String |
INSTANCE_SEPARATOR |
static String |
LATEST_EL_USE_CURRENT_TIME |
static long |
MINUTE_MSEC |
Constructor and Description |
---|
CoordELFunctions() |
Modifier and Type | Method and Description |
---|---|
static void |
configureEvaluator(ELEvaluator evaluator,
SyncCoordDataset ds,
SyncCoordAction coordAction)
Configure an evaluator with data set and application specific information.
|
static String |
coord_actualTime_echo() |
static String |
coord_conf(String property)
Return a job configuration property for the coordinator.
|
static String |
coord_days_echo(String n) |
static String |
coord_endOfDay_echo(String n) |
static String |
coord_endOfMonth_echo(String n) |
static String |
coord_hours_echo(String n) |
static String |
coord_minutes_echo(String n) |
static String |
coord_months_echo(String n) |
static String |
coord_user()
Return the user that submitted the coordinator job.
|
static String |
evalAndWrap(ELEvaluator eval,
String expr)
Helper method to wrap around with "${..}".
|
static List<Integer> |
expandOffsetTimes(Calendar startCal,
Calendar endCal,
ELEvaluator eval)
Takes two offset times and returns a list of multiples of the frequency offset from the effective nominal time that occur
between them.
|
static Calendar |
getCurrentInstance(Date effectiveTime,
int[] instanceCount)
Find the current instance based on effectiveTime (i.e Action_Creation_Time or Action_Start_Time)
|
static TimeZone |
getDatasetTZ() |
static TimeUnit |
getDSTimeUnit(ELEvaluator eval) |
static Calendar |
getEffectiveNominalTime() |
static String |
ph1_coord_absolute_echo(String date) |
static String |
ph1_coord_actionId_echo() |
static String |
ph1_coord_actualTime_echo_wrap() |
static String |
ph1_coord_current_echo(String n) |
static String |
ph1_coord_currentRange_echo(String start,
String end) |
static String |
ph1_coord_dataIn_echo(String n) |
static String |
ph1_coord_dataOut_echo(String n) |
static String |
ph1_coord_dateOffset_echo(String n,
String offset,
String unit) |
static String |
ph1_coord_dateTzOffset_echo(String n,
String timezone) |
static int |
ph1_coord_days(int val)
Used in defining the frequency in 'day' unit.
|
static String |
ph1_coord_daysInMonth_echo(String n) |
static int |
ph1_coord_endOfDays(int val)
Used in defining the frequency in 'day' unit and specify the "end of day" property.
|
static int |
ph1_coord_endOfMonths(int val)
Used in defining the frequency in 'month' unit and specify the "end of month" property.
|
static String |
ph1_coord_epochTime_echo(String dateTime,
String millis) |
static String |
ph1_coord_formatTime_echo(String dateTime,
String format) |
static String |
ph1_coord_future_echo(String n,
String instance) |
static String |
ph1_coord_futureRange_echo(String start,
String end,
String instance) |
static int |
ph1_coord_hours(int val)
Used in defining the frequency in 'hour' unit.
|
static String |
ph1_coord_hoursInDay_echo(String n) |
static String |
ph1_coord_latest_echo(String n) |
static String |
ph1_coord_latestRange_echo(String start,
String end) |
static int |
ph1_coord_minutes(int val)
Used in defining the frequency in 'minute' unit.
|
static int |
ph1_coord_months(int val)
Used in defining the frequency in 'month' unit.
|
static String |
ph1_coord_name_echo() |
static String |
ph1_coord_nominalTime_echo_fixed() |
static String |
ph1_coord_nominalTime_echo_wrap() |
static String |
ph1_coord_nominalTime_echo() |
static String |
ph1_coord_offset_echo(String n,
String timeUnit) |
static String |
ph1_coord_tzOffset_echo() |
static String |
ph2_coord_absolute_echo(String date) |
static String |
ph2_coord_absolute_range(String startInstance,
int end) |
static String |
ph2_coord_actionId()
Return Action Id.
|
static String |
ph2_coord_actualTime()
Return Action Start time.
|
static String |
ph2_coord_current_echo(String n) |
static String |
ph2_coord_current(int n)
Determine the date-time in Oozie processing timezone of n-th dataset instance.
|
static String |
ph2_coord_currentRange_echo(String start,
String end) |
static String |
ph2_coord_currentRange(int start,
int end)
Determine the date-time in Oozie processing timezone of current dataset instances
from start to end offsets from the nominal time.
|
static String |
ph2_coord_dateOffset(String strBaseDate,
int offset,
String unit)
Returns a date string that is offset from 'strBaseDate' by the amount specified.
|
static String |
ph2_coord_dateTzOffset(String strBaseDate,
String timezone)
Returns a date string that is offset from 'strBaseDate' by the difference from Oozie processing timezone to the given
timezone.
|
static int |
ph2_coord_daysInMonth(int n)
Calculate number of days in one month for n-th dataset instance.
|
static String |
ph2_coord_epochTime(String dateTimeStr,
String millis)
Convert from standard date-time formatting to a Unix epoch time.
|
static String |
ph2_coord_formatTime(String dateTimeStr,
String format)
Convert from standard date-time formatting to a desired format.
|
static String |
ph2_coord_future_echo(String n,
String instance) |
static String |
ph2_coord_futureRange_echo(String start,
String end,
String instance) |
static int |
ph2_coord_hoursInDay(int n)
Determine how many hours is on the date of n-th dataset instance.
|
static String |
ph2_coord_latest_echo(String n) |
static String |
ph2_coord_latestRange_echo(String start,
String end) |
static String |
ph2_coord_name()
Return Job Name.
|
static String |
ph2_coord_nominalTime()
Return nominal time or Action Creation Time.
|
static String |
ph2_coord_offset_echo(String n,
String timeUnit) |
static String |
ph2_coord_offset(int n,
String timeUnit)
Determine the date-time in Oozie processing timezone of the given offset from the dataset effective nominal time.
|
static int |
ph2_coord_tzOffset()
Calculate the difference of timezone offset in minutes between dataset and coordinator job.
|
static String |
ph3_coord_actionId() |
static String |
ph3_coord_actualTime() |
static String |
ph3_coord_dataIn(String dataInName)
Used to specify a list of URI's that are used as input dir to the workflow job.
|
static String |
ph3_coord_dataOut(String dataOutName)
Used to specify a list of URI's that are output dir of the workflow job.
|
static String |
ph3_coord_dateOffset(String strBaseDate,
int offset,
String unit) |
static String |
ph3_coord_dateTzOffset(String strBaseDate,
String timezone) |
static int |
ph3_coord_daysInMonth(int n) |
static String |
ph3_coord_epochTime(String dateTimeStr,
String millis) |
static String |
ph3_coord_formatTime(String dateTimeStr,
String format) |
static String |
ph3_coord_future(int n,
int instance)
Determine the date-time in Oozie processing timezone of n-th future available dataset instance
from nominal Time but not beyond the instance specified as 'instance.
|
static String |
ph3_coord_futureRange(int start,
int end,
int instance)
Determine the date-time in Oozie processing timezone of the future available dataset instances
from start to end offsets from nominal Time but not beyond the instance specified as 'instance'.
|
static int |
ph3_coord_hoursInDay(int n) |
static String |
ph3_coord_latest(int n)
Determine the date-time in Oozie processing timezone of n-th latest available dataset instance.
|
static String |
ph3_coord_latestRange(int start,
int end)
Determine the date-time in Oozie processing timezone of latest available dataset instances
from start to end offsets from the nominal time.
|
static String |
ph3_coord_name() |
static String |
ph3_coord_nominalTime() |
static int |
ph3_coord_tzOffset() |
static Calendar |
resolveOffsetRawTime(int n,
TimeUnit timeUnit,
ELEvaluator eval)
Resolve the offset time from the effective nominal time
|
public static final String DATASET
public static final String COORD_ACTION
public static final String CONFIGURATION
public static final String LATEST_EL_USE_CURRENT_TIME
public static final String INSTANCE_SEPARATOR
public static final String DIR_SEPARATOR
public static final long MINUTE_MSEC
public static final long HOUR_MSEC
public static final long DAY_MSEC
public CoordELFunctions()
public static int ph1_coord_days(int val)
domain: val > 0
and should be integer.
val
- frequency in number of days.public static int ph1_coord_months(int val)
domain: val > 0
and should be integer.
val
- frequency in number of months.public static int ph1_coord_hours(int val)
parameter value domain: val > 0
and should
be integer.
val
- frequency in number of hours.public static int ph1_coord_minutes(int val)
domain: val > 0
and should be integer.
val
- frequency in number of minutes.public static int ph1_coord_endOfDays(int val)
Every instance will start at 00:00 hour of each day.
domain: val > 0
and should be integer.
val
- frequency in number of days.public static int ph1_coord_endOfMonths(int val)
Every instance will start at first day of each month at 00:00 hour.
domain: val > 0
and should be integer.
val:
- frequency in number of months.public static int ph2_coord_tzOffset()
Depends on:
1. Timezone of both dataset and job
2. Action creation Time
public static int ph3_coord_tzOffset()
public static String ph2_coord_dateOffset(String strBaseDate, int offset, String unit) throws Exception
strBaseDate
- The base dateoffset
- any numberunit
- one of DAY, MONTH, HOUR, MINUTE, MONTHException
public static String ph3_coord_dateOffset(String strBaseDate, int offset, String unit) throws Exception
Exception
public static String ph2_coord_dateTzOffset(String strBaseDate, String timezone) throws Exception
strBaseDate
- The base datetimezone
- Exception
public static String ph3_coord_dateTzOffset(String strBaseDate, String timezone) throws Exception
Exception
public static String ph3_coord_future(int n, int instance) throws Exception
It depends on:
1. Data set frequency
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
7. Existence of dataset's directory
n
- :instance count
domain: n >= 0, n is integer
instance:
- How many future instance it should check? value should
be >=0Exception
public static String ph3_coord_futureRange(int start, int end, int instance) throws Exception
It depends on:
1. Data set frequency
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
7. Existence of dataset's directory
start
- : start instance offset
domain: start >= 0, start is integer
end
- : end instance offset
domain: end >= 0, end is integer
instance:
- How many future instance it should check? value should
be >=0Exception
public static String ph2_coord_nominalTime() throws Exception
Exception
- if unable to format the Date object to Stringpublic static String ph3_coord_nominalTime() throws Exception
Exception
public static String ph2_coord_formatTime(String dateTimeStr, String format) throws Exception
dateTimeStr
- - A timestamp in standard (ISO8601) format.format
- - A string representing the desired format.Exception
- if unable to format the Date object to Stringpublic static String ph3_coord_formatTime(String dateTimeStr, String format) throws Exception
Exception
public static String ph2_coord_epochTime(String dateTimeStr, String millis) throws Exception
dateTimeStr
- - A timestamp in standard (ISO8601) format.millis
- - "true" to include millis; otherwise will only include secondsException
- if unable to format the Date object to Stringpublic static String ph3_coord_epochTime(String dateTimeStr, String millis) throws Exception
Exception
public static String ph2_coord_actionId() throws Exception
Exception
public static String ph3_coord_actionId() throws Exception
Exception
public static String ph2_coord_name() throws Exception
Exception
public static String ph3_coord_name() throws Exception
Exception
public static String ph2_coord_actualTime() throws Exception
Exception
- if unable to format the Date object to Stringpublic static String ph3_coord_actualTime() throws Exception
Exception
public static String ph3_coord_dataIn(String dataInName)
Look for two evaluator-level variables
A) .datain.<DATAIN_NAME> B) .datain.<DATAIN_NAME>.unresolved
A defines the current list of URI.
B defines whether there are any unresolved EL-function (i.e latest)
If there are something unresolved, this function will echo back the original function
otherwise it sends the uris.
dataInName
- : Datain nameif there are unresolved EL function (i.e. latest) , echo back
the function without resolving the function.
public static String ph3_coord_dataOut(String dataOutName)
Look for one evaluator-level variable
dataout.<DATAOUT_NAME>
It defines the current list of URI.
otherwise it sends the uris.
dataOutName
- : Dataout namepublic static String ph2_coord_current(int n) throws Exception
It depends on:
1. Data set frequency
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
n
- instance count domain: n is integerException
public static String ph2_coord_currentRange(int start, int end) throws Exception
It depends on:
1. Data set frequency
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
start
- :start instance offset domain: start <= 0, start is integer
end
- :end instance offset domain: end <= 0, end is integer
If the current instance time of the dataset based on the Action Creation Time is earlier than the Initial-Instance of DS an empty string is returned. If an instance within the range is earlier than Initial-Instance of DS that instance is ignored
Exception
public static String ph2_coord_offset(int n, String timeUnit) throws Exception
It depends on:
1. Data set frequency
2. Data set Time Unit
3. Data set Time zone/DST
4. Data set initial instance
5. Action Creation Time
n
- offset amount (integer)timeUnit
- TimeUnit for offset n ("MINUTE", "HOUR", "DAY", "MONTH", "YEAR")Exception
- if there was a problem formattingpublic static int ph2_coord_hoursInDay(int n) throws Exception
It depends on:
1. Data set frequency
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
n
- instance count domain: n is integer
returns -1 means n-th instance is earlier than Initial-Instance of DS
Exception
public static int ph3_coord_hoursInDay(int n) throws Exception
Exception
public static int ph2_coord_daysInMonth(int n) throws Exception
It depends on:
1. Data set frequency .
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
n
- instance count. domain: n is integerreturns -1 means n-th instance is earlier than Initial-Instance of DS
Exception
public static int ph3_coord_daysInMonth(int n) throws Exception
Exception
public static String ph3_coord_latest(int n) throws Exception
It depends on:
1. Data set frequency
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
7. Existence of dataset's directory
n
- :instance count domain: n <= 0, n is integer
returns 'null' means n-th instance is earlier than Initial-Instance of DS
Exception
public static String ph3_coord_latestRange(int start, int end) throws Exception
It depends on:
1. Data set frequency
2. Data set Time unit (day, month, minute)
3. Data set Time zone/DST
4. End Day/Month flag
5. Data set initial instance
6. Action Creation Time
7. Existence of dataset's directory
start
- :start instance offset domain: start <= 0, start is integer
end
- :end instance offset domain: end <= 0, end is integer
returns 'null' means start offset instance is earlier than Initial-Instance of DS
Exception
public static void configureEvaluator(ELEvaluator evaluator, SyncCoordDataset ds, SyncCoordAction coordAction)
Helper method of associating dataset and application object
evaluator
- : to set variablesds
- : Data Set objectcoordAction
- : Application instancepublic static String evalAndWrap(ELEvaluator eval, String expr) throws Exception
eval
- :EL evaluatorexpr
- : expression to evaluateException
public static String ph1_coord_current_echo(String n)
public static String ph1_coord_absolute_echo(String date)
public static String ph1_coord_currentRange_echo(String start, String end)
public static String ph1_coord_offset_echo(String n, String timeUnit)
public static String ph2_coord_current_echo(String n)
public static String ph2_coord_currentRange_echo(String start, String end)
public static String ph2_coord_offset_echo(String n, String timeUnit)
public static String ph2_coord_absolute_echo(String date)
public static String ph2_coord_absolute_range(String startInstance, int end) throws Exception
Exception
public static String ph1_coord_dateOffset_echo(String n, String offset, String unit)
public static String ph1_coord_dateTzOffset_echo(String n, String timezone)
public static String ph1_coord_epochTime_echo(String dateTime, String millis)
public static String ph1_coord_formatTime_echo(String dateTime, String format)
public static String ph1_coord_latest_echo(String n)
public static String ph2_coord_latest_echo(String n)
public static String ph1_coord_future_echo(String n, String instance)
public static String ph2_coord_future_echo(String n, String instance)
public static String ph1_coord_latestRange_echo(String start, String end)
public static String ph2_coord_latestRange_echo(String start, String end)
public static String ph1_coord_futureRange_echo(String start, String end, String instance)
public static String ph2_coord_futureRange_echo(String start, String end, String instance)
public static String ph1_coord_dataIn_echo(String n)
public static String ph1_coord_dataOut_echo(String n)
public static String ph1_coord_nominalTime_echo()
public static String ph1_coord_nominalTime_echo_wrap()
public static String ph1_coord_nominalTime_echo_fixed()
public static String ph1_coord_actualTime_echo_wrap()
public static String ph1_coord_actionId_echo()
public static String ph1_coord_name_echo()
public static String coord_minutes_echo(String n)
public static String coord_hours_echo(String n)
public static String coord_days_echo(String n)
public static String coord_endOfDay_echo(String n)
public static String coord_months_echo(String n)
public static String coord_endOfMonth_echo(String n)
public static String coord_actualTime_echo()
public static String ph1_coord_hoursInDay_echo(String n)
public static String ph1_coord_daysInMonth_echo(String n)
public static String ph1_coord_tzOffset_echo()
public static Calendar getCurrentInstance(Date effectiveTime, int[] instanceCount)
public static Calendar getEffectiveNominalTime()
public static TimeUnit getDSTimeUnit(ELEvaluator eval)
public static TimeZone getDatasetTZ()
public static String coord_conf(String property)
property
- property name.null
if the property is undefined.public static String coord_user()
public static List<Integer> expandOffsetTimes(Calendar startCal, Calendar endCal, ELEvaluator eval)
As a simple example, assume its the same day: startCal is 1:00, endCal is 2:00, frequency is 20min, and effective nominal time is 1:20 -- then this method would return a list containing: -20, 0, 20, 40, 60
startCal
- The earlier offset timeendCal
- The later offset timeeval
- The ELEvaluator to use; cannot be nullpublic static Calendar resolveOffsetRawTime(int n, TimeUnit timeUnit, ELEvaluator eval)
n
- offset amount (integer)timeUnit
- TimeUnit for offset n ("MINUTE", "HOUR", "DAY", "MONTH", "YEAR")eval
- The ELEvaluator to use; or null to use the "current" evalCopyright © 2018 Apache Software Foundation. All rights reserved.