...
- Have run method of the custom action execute in the long transaction.
Instead of executing run() method in the transaction, ActionContext (and WorkflowActionContext) CustomActionContext can expose a method which will give user the ability to control the transaction. This is similar to the WorkerContext.
Code Block language java public interface ActionContext ... CustomActionContext extends RuntimeContext, Transactional, WorkflowInfoProvider, PluginContext, SecureStore { /** * ExecutesReturn athe setspecification of operationsthe viacustom aaction. {@link TxRunnable} that*/ are committed as a single transaction. CustomActionSpecification getSpecification(); /** * TheReturns {@linkthe TxRunnable}logical canstart gaintime accessof tothe {@linkbatch Dataset}job through the {@link DatasetContext} providedwhich triggers this instance of an action. * Logical start time is the time when the triggering Batch job is supposed to start if it. is started * by the *scheduler. @paramOtherwise runnableit thewould runnablebe tothe becurrent executedtime inwhen the action transactionruns. * @throws RuntimeException if failed to execute/ long getLogicalStartTime(); /** * Return the givenstate {@linkof TxRunnable}the incustom aaction. transaction */ @Override void execute(TxRunnable runnableProgramState getState(); }
- We can add support for executing Workers in the Workflow. However this will cause 2 additional containers to get launch - one for the application master and another for the worker itself. Also worker support running multiple instances which is not required in this case. Generally actions in the pipeline are not heavy duty and it would be ideal to execute them in the Workflow driver itself.
...