Search in sources :

Example 1 with LocalOozieClient

use of org.apache.oozie.LocalOozieClient in project oozie by apache.

the class SubWorkflowActionExecutor method getWorkflowClient.

protected OozieClient getWorkflowClient(Context context, String oozieUri) {
    OozieClient oozieClient;
    if (oozieUri.equals(LOCAL)) {
        WorkflowJobBean workflow = (WorkflowJobBean) context.getWorkflow();
        String user = workflow.getUser();
        String group = workflow.getGroup();
        DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(user);
        oozieClient = new LocalOozieClient(dagEngine);
    } else {
        // TODO we need to add authToken to the WC for the remote case
        oozieClient = new OozieClient(oozieUri);
    }
    return oozieClient;
}
Also used : OozieClient(org.apache.oozie.client.OozieClient) LocalOozieClient(org.apache.oozie.LocalOozieClient) DagEngine(org.apache.oozie.DagEngine) DagEngineService(org.apache.oozie.service.DagEngineService) LocalOozieClient(org.apache.oozie.LocalOozieClient) WorkflowJobBean(org.apache.oozie.WorkflowJobBean)

Example 2 with LocalOozieClient

use of org.apache.oozie.LocalOozieClient in project oozie by apache.

the class LocalOozie method getClient.

/**
 * Return a {@link org.apache.oozie.client.OozieClient} for LocalOozie configured for a given user.
 * <p>
 * The following methods of the client are NOP in the returned instance:
 * {@link org.apache.oozie.client.OozieClient#validateWSVersion},
 * {@link org.apache.oozie.client.OozieClient#setHeader},
 * {@link org.apache.oozie.client.OozieClient#getHeader},
 * {@link org.apache.oozie.client.OozieClient#removeHeader},
 * {@link org.apache.oozie.client.OozieClient#getHeaderNames},
 * {@link org.apache.oozie.client.OozieClient#setSystemMode(OozieClient.SYSTEM_MODE)},
 * {@link org.apache.oozie.client.OozieClient#getHeaders},
 * {@link org.apache.oozie.client.OozieClient#getClientBuildVersion}.
 *
 * @param user user name to use in LocalOozie for running workflows.
 * @return a {@link org.apache.oozie.client.OozieClient} for LocalOozie configured for the given user.
 */
public static OozieClient getClient(String user) {
    if (!localOozieActive) {
        throw new IllegalStateException("LocalOozie is not initialized");
    }
    ParamChecker.notEmpty(user, "user");
    DagEngine dagEngine = Services.get().get(DagEngineService.class).getDagEngine(user);
    return new LocalOozieClient(dagEngine);
}
Also used : DagEngine(org.apache.oozie.DagEngine) DagEngineService(org.apache.oozie.service.DagEngineService) LocalOozieClient(org.apache.oozie.LocalOozieClient)

Aggregations

DagEngine (org.apache.oozie.DagEngine)2 LocalOozieClient (org.apache.oozie.LocalOozieClient)2 DagEngineService (org.apache.oozie.service.DagEngineService)2 WorkflowJobBean (org.apache.oozie.WorkflowJobBean)1 OozieClient (org.apache.oozie.client.OozieClient)1