Thanks Josh. I followed the former approach involving TaskInputOutputContext and I am able to implement the job counters.
On Thu, Feb 12, 2015 at 4:19 PM, Josh Wills <[email protected]> wrote: > You could pass the TaskInputOutputContext to foo and call its Counter > methods directly, something like: > > @Override > public void process (S input, Emitter<T> emitter) { > foo.processAndEmitEvents(bar, emitter, getContext()); > } > > or you could add a public inc() method to your A class, pass "this" to > processAndEmitEvents, and have that public inc() method call the protected > increment() method. > > J > > > On Thu, Feb 12, 2015 at 4:12 PM, venkatesh kavuluri < > [email protected]> wrote: > >> Hi All, >> >> I am trying to figure out the best way to call increment method (for >> counters) from a helper class invoked from DoFn#process. >> >> I have something like this. >> >> class A extends DoFn<> { >> >> Foo foo = nee Foo(); // helper class >> >> @Override >> public void process (S input, Emitter<T> emitter) { >> foo.processAndEmitEvents(bar, emitter); >> } >> >> I want to call DoFn#increment method from Foo#processAndEmitEvents. Is >> there a better way to go about it other than “Foo" extending “A” just to >> get hold of DoFn#increment. >> >> Thanks for the help. >> > > > > -- > Director of Data Science > Cloudera <http://www.cloudera.com> > Twitter: @josh_wills <http://twitter.com/josh_wills> >
