giraph-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Saltz <sal...@gmail.com>
Subject Re: How do I validate customArguments?
Date Thu, 28 Aug 2014 18:26:26 GMT
Matt,

I'm not sure if you've resolved this problem already or not, but if you
haven't: The initialize() method isn't limited to registering aggregators,
and in fact, in my project I use it to do exactly what you're describing to
check and load custom configuration parameters. Inside the initialize()
method, I do this:

*    String numPreprocessingStepsConf =
getConf().get(NUMBER_OF_PREPROCESSING_STEPS_CONF_OPT);*
*    numPreprocessingSteps = (numPreprocessingStepsConf != null) ?*
*        Integer.parseInt(numPreprocessingStepsConf.trim()) :*
*        DEFAULT_NUMBER_OF_PREPROCESSING_STEPS;*
*    System.out.println("Number of preprocessing steps: " +
numPreprocessingSteps);*

where at the class level I declare:

  public static final String NUMBER_OF_PREPROCESSING_STEPS_CONF_OPT =
"wcc.numPreprocessingSteps";
  public static final int DEFAULT_NUMBER_OF_PREPROCESSING_STEPS = 1;
  public static int numPreprocessingSteps;

To set the property, I use the option "-ca
wcc.numPreprocessingSteps=<number of steps I want>". If you need to check
that it's properly formatted and not store them, this is a fine place to do
it as well, given that it's run before the input superstep (see the giraph
code in BspServiceMaster, line 1617 in the stable 1.1.0 release). What
happens is that on the master, the MasterThread calls coordinateSuperstep()
on a BspServiceMaster object, which checks if it's the input superstep, and
if so, calls initialize() on the MasterCompute object (created in the
becomeMaster() method of BspServiceMaster).

Hope this helps,
Matthew



On Tue, Aug 26, 2014 at 4:36 PM, Matthew Cornell <matt@matthewcornell.org>
wrote:

> Hi again. My application needs to pass in a String argument to the
> computation which each Vertex needs access to. (The argument is a list of
> the form "[item1, item2, ...]".) I found --customArguments (which I set in
> my tests via conf.set(<arg_name>, <arg_val>)) but I need to check that it's
> properly formatted. Where do I do that? The only thing I thought of is to
> specify a DefaultMasterCompute subclass whose initialize() does the check,
> but all the initialize() examples do is register aggregators; none of them
> check args or do anything else. Thanks in advance! -- matt
>
> --
> Matthew Cornell | matt@matthewcornell.org | 413-626-3621 | 34 Dickinson
> Street, Amherst MA 01002 | matthewcornell.org
>

Mime
View raw message