Hello everybody,

I have a problem implementing a custom asynchronnous action. My class extends from ActionExecutor, and overwrites the methods initActionType, start, end, check, kill and isCompleted.

In the start method, i want to to start a YARN job, that is implemented through my BiohadoopClient class. To make the call asynchronous, i wrapped the client.run() method in a Callable:

public void start(final Context context, final WorkflowAction action) {
...
    Callable<String> biohadoop = new Callable<String>() {
        BiohadoopClient client = new BiohadoopClient();
        client.run();
    }

    // submit callable to executor
    executor.submit(biohadoop);

// set the start data, according to https://oozie.apache.org/docs/4.0.1/DG_CustomActionExecutor.html
    context.setStartData(externalId, callBackUrl, callBackUrl);
...
}

This works fine, and for example when I use my custom action in a fork/join manner, the execution of the actions runs in parallel.

Now, the problem is, that Oozie remains in a RUNNING state for this actions. It seems impossible to change that to a completed state. The check() method is never called by Oozie, the same is true for the end() method. It doesn't help to set the context.setExternalStatus(), context.setExecutionData() and context.setEndData() manually in the Callable (after the client.run() has finished). I tried also to queue manually an ActionEndXCommand, but without luck.

When I wait in the start() method for the Callable to complete, the state gets updated correctly, but the execution in fork/join isn't parallel anymore (which seem logic, as the execution waits for the Callable to complete).

So far I haven't found any example howto write an asynchronous custom action, can anybody please help me?

Thank you
Christian

Reply via email to