Hi Priyanka,

   To invoke definePartitions method after updating new value dynamically,
you can implement StatsListener interface in the operator. And in the
overridden processStats method, you can have something like:

public Response processStats(BatchedOperatorStats stats)
  {
    Response res = new Response();
    res.repartitionRequired = false;
    if (intProp != oldIntProp) {
      res.repartitionRequired = true;
    }
    return res;
  }

  However, this will redeploy the partitions again, even if partitioning is
not changed. May be you can try storing the number of partitions as an
operator property and use that to divide the intProp value?

Thanks,
Isha


On Tue, Sep 22, 2015 at 5:37 AM, Priyanka Gugale <[email protected]>
wrote:

> I have an integer property named "intProp". This property is applicable to
> an operator A. I can set the property from dtcli using
> "set-operator-property operator-name property-name property-value" and this
> will get applied to all instances of opeartor A.
>
> Now, I want to apply this property in a way that it's equally divided
> amongst all instances of operator A. For example,  if intProp=100 and
> number of partitions=4 then intProp=25 should be set on each instance of
> operator A.
>
> Is there a way to achieve this?
>
> I have tried following approach to do this: I have overriden
> definePartitions of Operator, once we do partitioning I am setting right
> value on each operator instance based on new partition count. The
> limitation here is that the value is applied during definePartitions. If
> the value is updated dynamically it won't be applied till definePartitions
> is called again.
>
> -Priyanka
>

Reply via email to