apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vlad Rozov <v.ro...@datatorrent.com>
Subject Re: Difference between setup() and activate()
Date Mon, 31 Jul 2017 17:38:09 GMT
Do you refer to restoring from a checkpoint as serialize/deserialize 
cycles? There are no calls to setup/teardown and/or activate/deactivate 
during checkpointing/serialization. In case of restoring from a 
checkpoint (deserialization) setup() is a part of a redeployment 
request, AFAIK. The best answer to question 3 is it depends. In most 
cases using setup() to resolve all transient field is as good as doing 
that in activate(). Please see ActivationListener javadoc for details 
when it is necessary to use activate() vs setup().

Thank you,

Vlad

On 7/29/17 19:58, Sanjay Pujare wrote:
> The Javadoc comment
> for com.datatorrent.api.Operator.ActivationListener<CONTEXT>  (in
> https://github.com/apache/apex-core/blob/master/api/src/main/java/com/datatorrent/api/Operator.java)
> should hopefully answer your questions.
>
> Specifically:
>
> 1. No, setup() is called only once in the entire lifetime (
> http://apex.apache.org/docs/apex/operator_development/#setup-call)
>
> 2. Yes. When an operator is "activated" - first time in its life or
> reactivation after a failover -  actuvate() is called before the first
> beginWindow() is called.
>
> 3. Yes.
>
>
> On Sun, Jul 30, 2017 at 12:18 AM, Ananth G <ananthg.apex@gmail.com> wrote:
>
>> Hello All,
>>
>> I was looking at the documentation and could not get a clear distinction
>> of behaviours for setup() and activate() during scenarios when an operator
>> is passivated ( ex: application shutdown, repartition use cases ) and being
>> brought back to life again. Could someone from the community advise me on
>> the following questions ?
>>
>> 1. Is setup() called in these scenarios (serialize/deserialize cycles) as
>> well ?
>>
>> 2. I am assuming activate() is called in these scenarios ? - The javadoc
>> for activation states that the activate() can be called multiple times (
>> without explicitly stating why ) and my assumption is that it is because of
>> these scenarios.
>>
>> 3. If setup() is only called once during the lifetime of an operator , is
>> it fair to assume that activate() is the best place to resolve all of the
>> transient fields of an operator ?
>>
>>
>> Regards,
>> Ananth


Mime
View raw message