Yeah this was me being rather silly. In scala, code that’s outside of any 
function is executed as part of the default constructor, so everything might 
not have been inited by then. When I moved it to the initialize function, 
things cleared up.
-- 
Artie Pesh-Imam
Software Engineer @ Tapad
201-253-9647
From: Ameya Vilankar Ameya Vilankar
Reply: [email protected] [email protected]
Date: November 19, 2013 at 2:58:02 PM
To: [email protected] [email protected]
Subject:  Re: NPE when trying to register a persistent aggregator  
I don't understand this part of the code. Can you please explain?

class ReflexivePairMasterCompute extends DefaultMasterCompute {
  registerPersistentAggregator[LongArrayListWriteable]("reflexive_edges", 
classOf[LongArrayListAggregator])
  registerPersistentAggregator[LongArrayListWriteable]("non_reflexive_edges", 
classOf[LongArrayListAggregator]
}

What I would do:
Typically you extend DefaultMasterCompute and then override the initialize 
method where you register all the aggregators that you want. Do it like this.

class ReflexivePairMasterCompute extends DefaultMasterCompute {

    @Override
    public void initialize() throws InstantiationException, 
IllegalAccessException {
        registerPersistentAggregator("reflexive_edges", 
LongArrayListAggregator.class);
        registerPersistentAggregator("non_reflexive_edges", 
LongArrayListAggregator.class);
    }
}




On Mon, Nov 18, 2013 at 11:53 PM, Artie Pesh-Imam <[email protected]> 
wrote:
Hi all,

Im trying to register a persistent aggregator and am getting a NPE:
version: Giraph 1.0 running against hadoop 1

java.lang.NullPointerException
at 
org.apache.giraph.master.MasterCompute.registerPersistentAggregator(MasterCompute.java:152)

class ReflexivePairMasterCompute extends DefaultMasterCompute {
  registerPersistentAggregator[LongArrayListWriteable]("reflexive_edges", 
classOf[LongArrayListAggregator])
  registerPersistentAggregator[LongArrayListWriteable]("non_reflexive_edges", 
classOf[LongArrayListAggregator]
}

Any ideas? It looks like it’s having issues with the following line, which 
leads me to wonder if I need to do something to init the graph state: 

return getGraphState().getGraphTaskManager().getMasterAggregatorUsage().

        registerPersistentAggregator(name, aggregatorClass);



-- 
Artie Pesh-Imam
Software Engineer @ Tapad
201-253-9647

Reply via email to