Hi Christian,

There are two main things that trigger Oozie to call the check() method:
1) There's a time interval at which it calls check().  This gets called by
ActionCheckXCommand, which gets queued by the ActionCheckerService.  By
default, the service queues up ActionCheckXCommands every minute but only
per action every 10 minutes.  In other words, it can take up to 10-11
minutes for check() to be called.  The reason it's 10 minutes is that this
is considered a fallback procedure in case #2 doesn't work (see below).
2) Oozie has a CallbackServlet and CallbackService, which are responsible
for listening for an HTTP callback from completed actions.  This triggers a
call to check() to verify that it has indeed finished (and isn't lying).
You'll want to make sure that something does a GET on the correct callback
URL (CallbackService can generate it for you).

By an asynchronous action, do you mean that your action calls
something in BiohadoopClient
and you want Oozie to continue with the next action in the workflow,
without waiting for BiohadoopClient to complete whatever it's doing?
Oozie's current actions aren't really designed to work that way, and it
might be simpler to just use the Java action if that's all you want to do.
That said, if you want Oozie to continue while BiohadoopClient is still
running, you can probably just call check() or end() directly from start().


- Robert

On Thu, Oct 9, 2014 at 7:46 AM, Christian Gapp <[email protected]> wrote:

> Hello,
>
> has somebody so far a solution for this problem? Or at least hints?
>
> Christian
>
> Am 2014-10-03 um 16:47 schrieb Christian Gapp:
>
>  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