Search in sources :

Example 46 with ELEvaluator

use of org.apache.oozie.util.ELEvaluator in project oozie by apache.

the class CoordELFunctions method getJobTZ.

/**
 * @return TimeZone for the application or job.
 */
private static TimeZone getJobTZ() {
    ELEvaluator eval = ELEvaluator.getCurrent();
    SyncCoordAction coordAction = (SyncCoordAction) eval.getVariable(COORD_ACTION);
    if (coordAction == null) {
        throw new RuntimeException("Associated Application instance should be defined with key " + COORD_ACTION);
    }
    return coordAction.getTimeZone();
}
Also used : ELEvaluator(org.apache.oozie.util.ELEvaluator)

Example 47 with ELEvaluator

use of org.apache.oozie.util.ELEvaluator in project oozie by apache.

the class CoordELFunctions method ph2_coord_actionId.

/**
 * Return Action Id.
 *
 * @return coordinator action Id
 */
public static String ph2_coord_actionId() throws Exception {
    ELEvaluator eval = ELEvaluator.getCurrent();
    SyncCoordAction action = ParamChecker.notNull((SyncCoordAction) eval.getVariable(COORD_ACTION), "Coordinator Action");
    return action.getActionId();
}
Also used : ELEvaluator(org.apache.oozie.util.ELEvaluator)

Example 48 with ELEvaluator

use of org.apache.oozie.util.ELEvaluator in project oozie by apache.

the class CoordELFunctions method ph1_coord_dataOut_echo.

public static String ph1_coord_dataOut_echo(String n) {
    ELEvaluator eval = ELEvaluator.getCurrent();
    String val = (String) eval.getVariable("oozie.dataname." + n);
    if (val == null || val.equals("data-out") == false) {
        XLog.getLog(CoordELFunctions.class).error("data_out_name " + n + " is not valid");
        throw new RuntimeException("data_out_name " + n + " is not valid");
    }
    return echoUnResolved("dataOut", "'" + n + "'");
}
Also used : ELEvaluator(org.apache.oozie.util.ELEvaluator)

Example 49 with ELEvaluator

use of org.apache.oozie.util.ELEvaluator in project oozie by apache.

the class CoordELFunctions method ph1_coord_days.

/**
 * Used in defining the frequency in 'day' unit. <p> domain: <code> val &gt; 0</code> and should be integer.
 *
 * @param val frequency in number of days.
 * @return number of days and also set the frequency timeunit to "day"
 */
public static int ph1_coord_days(int val) {
    val = ParamChecker.checkGTZero(val, "n");
    ELEvaluator eval = ELEvaluator.getCurrent();
    eval.setVariable("timeunit", TimeUnit.DAY);
    eval.setVariable("endOfDuration", TimeUnit.NONE);
    return val;
}
Also used : ELEvaluator(org.apache.oozie.util.ELEvaluator)

Example 50 with ELEvaluator

use of org.apache.oozie.util.ELEvaluator in project oozie by apache.

the class CoordELFunctions method ph1_coord_minutes.

/**
 * Used in defining the frequency in 'minute' unit. <p> domain: <code> val &gt; 0</code> and should be integer.
 *
 * @param val frequency in number of minutes.
 * @return number of minutes and also set the frequency timeunit to "minute"
 */
public static int ph1_coord_minutes(int val) {
    val = ParamChecker.checkGTZero(val, "n");
    ELEvaluator eval = ELEvaluator.getCurrent();
    eval.setVariable("timeunit", TimeUnit.MINUTE);
    eval.setVariable("endOfDuration", TimeUnit.NONE);
    return val;
}
Also used : ELEvaluator(org.apache.oozie.util.ELEvaluator)

Aggregations

ELEvaluator (org.apache.oozie.util.ELEvaluator)72 Element (org.jdom.Element)16 ELService (org.apache.oozie.service.ELService)15 XConfiguration (org.apache.oozie.util.XConfiguration)15 Configuration (org.apache.hadoop.conf.Configuration)13 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)11 URISyntaxException (java.net.URISyntaxException)9 WorkflowActionBean (org.apache.oozie.WorkflowActionBean)9 CoordELEvaluator (org.apache.oozie.coord.CoordELEvaluator)8 EndNodeDef (org.apache.oozie.workflow.lite.EndNodeDef)7 LiteWorkflowApp (org.apache.oozie.workflow.lite.LiteWorkflowApp)7 LiteWorkflowInstance (org.apache.oozie.workflow.lite.LiteWorkflowInstance)7 StartNodeDef (org.apache.oozie.workflow.lite.StartNodeDef)7 CommandException (org.apache.oozie.command.CommandException)6 IOException (java.io.IOException)5 StringReader (java.io.StringReader)5 URI (java.net.URI)5 Date (java.util.Date)5 Map (java.util.Map)5 HCatURI (org.apache.oozie.util.HCatURI)5