当前位置: 首页>>代码示例>>Java>>正文


Java GiraphJob.getConfiguration方法代码示例

本文整理汇总了Java中org.apache.giraph.job.GiraphJob.getConfiguration方法的典型用法代码示例。如果您正苦于以下问题:Java GiraphJob.getConfiguration方法的具体用法?Java GiraphJob.getConfiguration怎么用?Java GiraphJob.getConfiguration使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.giraph.job.GiraphJob的用法示例。


在下文中一共展示了GiraphJob.getConfiguration方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBspSuperStep

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
 * Run a sample BSP job locally and test supersteps.
 *
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testBspSuperStep()
    throws IOException, InterruptedException, ClassNotFoundException {
  String callingMethod = getCallingMethodName();
  Path outputPath = getTempPath(callingMethod);
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setComputationClass(SimpleSuperstepComputation.class);
  conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
  conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
  GiraphJob job = prepareJob(callingMethod, conf, outputPath);
  Configuration configuration = job.getConfiguration();
  // GeneratedInputSplit will generate 10 vertices
  GeneratedVertexReader.READER_VERTICES.set(configuration, 10);
  assertTrue(job.run(true));
  if (!runningInDistributedMode()) {
    FileStatus fileStatus = getSinglePartFileStatus(configuration, outputPath);
    assertEquals(49l, fileStatus.getLen());
  }
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:27,代码来源:TestBspBasic.java

示例2: testBspSuperStep

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
 * Run a sample BSP job locally and test supersteps.
 *
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
@Test
public void testBspSuperStep()
    throws IOException, InterruptedException, ClassNotFoundException {
  String callingMethod = getCallingMethodName();
  Path outputPath = getTempPath(callingMethod);
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(SimpleSuperstepVertex.class);
  conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
  conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
  GiraphJob job = prepareJob(callingMethod, conf, outputPath);
  Configuration configuration = job.getConfiguration();
  // GeneratedInputSplit will generate 10 vertices
  configuration.setLong(GeneratedVertexReader.READER_VERTICES, 10);
  assertTrue(job.run(true));
  if (!runningInDistributedMode()) {
    FileStatus fileStatus = getSinglePartFileStatus(configuration, outputPath);
    assertEquals(49l, fileStatus.getLen());
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:27,代码来源:TestBspBasic.java

示例3: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override
public int run(String[] args) throws Exception {
    if (args.length != 3) {
        throw new IllegalArgumentException(
            "Syntax error: Must have 3 arguments <numbersOfWorkers> <inputLocaiton> <outputLocation>");
    }

    int numberOfWorkers = Integer.parseInt(args[0]);
    String inputLocation = args[1];
    String outputLocation = args[2];

    GiraphJob job = new GiraphJob(getConf(), getClass().getName());
    GiraphConfiguration gconf = job.getConfiguration();
    gconf.setWorkerConfiguration(numberOfWorkers, numberOfWorkers, 100.0f);

    GiraphFileInputFormat.addVertexInputPath(gconf, new Path(inputLocation));
    FileOutputFormat.setOutputPath(job.getInternalJob(), new Path(outputLocation));

    gconf.setComputationClass(ZombieComputation.class);
    gconf.setMasterComputeClass(ZombieMasterCompute.class);
    gconf.setVertexInputFormatClass(ZombieTextVertexInputFormat.class);
    gconf.setVertexOutputFormatClass(ZombieTextVertexOutputFormat.class);
    gconf.setWorkerContextClass(ZombieWorkerContext.class);

    boolean verbose = true;
    if (job.run(verbose)) {
        return 0;
    } else {
        return -1;
    }
}
 
开发者ID:amitchmca,项目名称:hadooparchitecturebook,代码行数:32,代码来源:ZombieBiteJob.java

示例4: testRyaInput

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Test
public void testRyaInput() throws Exception {

    AccumuloRdfConfiguration conf = getConf();
    AccumuloRyaDAO ryaDAO = RyaSailFactory.getAccumuloDAO(conf);

    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred1"),
            new RyaURI("urn:test#obj1")));
    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred2"),
            new RyaURI("urn:test#obj2")));
    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred3"),
            new RyaURI("urn:test#obj3")));
    ryaDAO.add(new RyaStatement(new RyaURI("urn:test#1234"),
            new RyaURI("urn:test#pred4"),
            new RyaURI("urn:test#obj4")));
    ryaDAO.flush();

    GiraphJob job = new GiraphJob(conf, getCallingMethodName());

    setupConfiguration(job);
    GiraphConfiguration giraphConf = job.getConfiguration();
    giraphConf.setComputationClass(EdgeNotification.class);
    giraphConf.setVertexInputFormatClass(RyaVertexInputFormat.class);
    giraphConf.setVertexOutputFormatClass(TestTextOutputFormat.class);


    if (log.isInfoEnabled())
        log.info("Running edge notification job using Rya Vertex input");

}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:34,代码来源:TestVertexFormat.java

示例5: testInstantiateVertex

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
 * Just instantiate the vertex (all functions are implemented) and the
 * VertexInputFormat using reflection.
 *
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws InterruptedException
 * @throws IOException
 * @throws InvocationTargetException
 * @throws IllegalArgumentException
 * @throws NoSuchMethodException
 * @throws SecurityException
 */
@Test
public void testInstantiateVertex()
    throws InstantiationException, IllegalAccessException,
    IOException, InterruptedException, IllegalArgumentException,
    InvocationTargetException, SecurityException, NoSuchMethodException {
  System.out.println("testInstantiateVertex: java.class.path=" +
      System.getProperty("java.class.path"));
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setComputationClass(SimpleSuperstepComputation.class);
  conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
  GiraphJob job = prepareJob(getCallingMethodName(), conf);
  ImmutableClassesGiraphConfiguration configuration =
      new ImmutableClassesGiraphConfiguration(job.getConfiguration());
  Vertex<LongWritable, IntWritable, FloatWritable> vertex =
      configuration.createVertex();
  vertex.initialize(new LongWritable(1), new IntWritable(1));
  System.out.println("testInstantiateVertex: Got vertex " + vertex);
  VertexInputFormat<LongWritable, IntWritable, FloatWritable>
  inputFormat = configuration.createWrappedVertexInputFormat();
  List<InputSplit> splitArray = inputFormat.getSplits(
      HadoopUtils.makeJobContext(), 1);
  ByteArrayOutputStream byteArrayOutputStream =
      new ByteArrayOutputStream();
  DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
  ((Writable) splitArray.get(0)).write(outputStream);
  System.out.println("testInstantiateVertex: Example output split = " +
      byteArrayOutputStream.toString());
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:42,代码来源:TestBspBasic.java

示例6: testInstantiateVertex

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
   * Just instantiate the vertex (all functions are implemented) and the
   * VertexInputFormat using reflection.
   *
   * @throws IllegalAccessException
   * @throws InstantiationException
   * @throws InterruptedException
   * @throws IOException
   * @throws InvocationTargetException
   * @throws IllegalArgumentException
   * @throws NoSuchMethodException
   * @throws SecurityException
   */
  @Test
  public void testInstantiateVertex()
      throws InstantiationException, IllegalAccessException,
      IOException, InterruptedException, IllegalArgumentException,
      InvocationTargetException, SecurityException, NoSuchMethodException {
    System.out.println("testInstantiateVertex: java.class.path=" +
        System.getProperty("java.class.path"));
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setVertexClass(SimpleSuperstepVertex.class);
    conf.setVertexInputFormatClass(
        SimpleSuperstepVertex.SimpleSuperstepVertexInputFormat.class);
    GiraphJob job = prepareJob(getCallingMethodName(), conf);
    ImmutableClassesGiraphConfiguration configuration =
        new ImmutableClassesGiraphConfiguration(job.getConfiguration());
    Vertex<LongWritable, IntWritable, FloatWritable, IntWritable> vertex =
        configuration.createVertex();
    vertex.initialize(new LongWritable(1), new IntWritable(1));
    System.out.println("testInstantiateVertex: Got vertex " + vertex);
    VertexInputFormat<LongWritable, IntWritable, FloatWritable>
    inputFormat = configuration.createVertexInputFormat();
/*if[HADOOP_NON_JOBCONTEXT_IS_INTERFACE]
      List<InputSplit> splitArray =
          inputFormat.getSplits(
              new JobContext(new Configuration(), new JobID()), 1);
else[HADOOP_NON_JOBCONTEXT_IS_INTERFACE]*/
      List<InputSplit> splitArray =
          inputFormat.getSplits(
              new JobContextImpl(new Configuration(), new JobID()), 1);
/*end[HADOOP_NON_JOBCONTEXT_IS_INTERFACE]*/
    ByteArrayOutputStream byteArrayOutputStream =
        new ByteArrayOutputStream();
    DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
    ((Writable) splitArray.get(0)).write(outputStream);
    System.out.println("testInstantiateVertex: Example output split = " +
        byteArrayOutputStream.toString());
  }
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:50,代码来源:TestBspBasic.java

示例7: setupConfiguration

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
 * Adjust the configuration to the basic test case
 */
public final Configuration setupConfiguration(GiraphJob job)
    throws IOException {
  GiraphConfiguration conf = job.getConfiguration();
  conf.set("mapred.jar", getJarLocation());

  // Allow this test to be run on a real Hadoop setup
  if (runningInDistributedMode()) {
    System.out.println("setupConfiguration: Sending job to job tracker " +
        jobTracker + " with jar path " + getJarLocation()
        + " for " + getName());
    conf.set("mapred.job.tracker", jobTracker);
    conf.setWorkerConfiguration(getNumWorkers(), getNumWorkers(), 100.0f);
  }
  else {
    System.out.println("setupConfiguration: Using local job runner with " +
        "location " + getJarLocation() + " for " + getName());
    conf.setWorkerConfiguration(1, 1, 100.0f);
    // Single node testing
    GiraphConstants.SPLIT_MASTER_WORKER.set(conf, false);
    GiraphConstants.LOCAL_TEST_MODE.set(conf, true);
  }
  conf.setMaxMasterSuperstepWaitMsecs(30 * 1000);
  conf.setEventWaitMsecs(3 * 1000);
  GiraphConstants.ZOOKEEPER_SERVERLIST_POLL_MSECS.set(conf, 500);
  if (getZooKeeperList() != null) {
    conf.setZooKeeperConfiguration(getZooKeeperList());
  }
  // GeneratedInputSplit will generate 5 vertices
  conf.setLong(READER_VERTICES_OPT, 5);

  // Setup pathes for temporary files
  Path zookeeperDir = getTempPath("_bspZooKeeper");
  Path zkManagerDir = getTempPath("_defaultZkManagerDir");
  Path checkPointDir = getTempPath("_checkpoints");

  // We might start several jobs per test, so we need to clean up here
  FileUtils.deletePath(conf, zookeeperDir);
  FileUtils.deletePath(conf, zkManagerDir);
  FileUtils.deletePath(conf, checkPointDir);

  conf.set(GiraphConstants.ZOOKEEPER_DIR, zookeeperDir.toString());
  GiraphConstants.ZOOKEEPER_MANAGER_DIRECTORY.set(conf,
      zkManagerDir.toString());
  GiraphConstants.CHECKPOINT_DIRECTORY.set(conf, checkPointDir.toString());

  return conf;
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:51,代码来源:BspCase.java

示例8: testInstantiateVertex

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
 * Just instantiate the vertex (all functions are implemented) and the
 * VertexInputFormat using reflection.
 *
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws InterruptedException
 * @throws IOException
 * @throws InvocationTargetException
 * @throws IllegalArgumentException
 * @throws NoSuchMethodException
 * @throws SecurityException
 */
@Test
public void testInstantiateVertex()
    throws InstantiationException, IllegalAccessException,
    IOException, InterruptedException, IllegalArgumentException,
    InvocationTargetException, SecurityException, NoSuchMethodException {
  System.out.println("testInstantiateVertex: java.class.path=" +
      System.getProperty("java.class.path"));
  GiraphConfiguration conf = new GiraphConfiguration();
  conf.setVertexClass(SimpleSuperstepVertex.class);
  conf.setVertexInputFormatClass(
      SimpleSuperstepVertex.SimpleSuperstepVertexInputFormat.class);
  GiraphJob job = prepareJob(getCallingMethodName(), conf);
  ImmutableClassesGiraphConfiguration configuration =
      new ImmutableClassesGiraphConfiguration(job.getConfiguration());
  Vertex<LongWritable, IntWritable, FloatWritable, IntWritable> vertex =
      configuration.createVertex();
  vertex.initialize(new LongWritable(1), new IntWritable(1));
  System.out.println("testInstantiateVertex: Got vertex " + vertex);
  VertexInputFormat<LongWritable, IntWritable, FloatWritable>
  inputFormat = configuration.createVertexInputFormat();

    List<InputSplit> splitArray =
        inputFormat.getSplits(
            new JobContext(new Configuration(), new JobID()), 1);









  ByteArrayOutputStream byteArrayOutputStream =
      new ByteArrayOutputStream();
  DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream);
  ((Writable) splitArray.get(0)).write(outputStream);
  System.out.println("testInstantiateVertex: Example output split = " +
      byteArrayOutputStream.toString());
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:54,代码来源:TestBspBasic.java

示例9: setupConfiguration

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
 * Adjust the configuration to the basic test case
 */
public final Configuration setupConfiguration(GiraphJob job)
    throws IOException {
  GiraphConfiguration conf = job.getConfiguration();
  conf.set("mapred.jar", getJarLocation());

  // Allow this test to be run on a real Hadoop setup
  if (runningInDistributedMode()) {
    System.out.println("setupConfiguration: Sending job to job tracker " +
        jobTracker + " with jar path " + getJarLocation()
        + " for " + getName());
    conf.set("mapred.job.tracker", jobTracker);
    conf.setWorkerConfiguration(getNumWorkers(), getNumWorkers(), 100.0f);
  }
  else {
    System.out.println("setupConfiguration: Using local job runner with " +
        "location " + getJarLocation() + " for " + getName());
    conf.setWorkerConfiguration(1, 1, 100.0f);
    // Single node testing
    GiraphConstants.SPLIT_MASTER_WORKER.set(conf, false);
  }
  conf.setMaxMasterSuperstepWaitMsecs(30 * 1000);
  conf.setEventWaitMsecs(3 * 1000);
  GiraphConstants.ZOOKEEPER_SERVERLIST_POLL_MSECS.set(conf, 500);
  if (getZooKeeperList() != null) {
    conf.setZooKeeperConfiguration(getZooKeeperList());
  }
  // GeneratedInputSplit will generate 5 vertices
  conf.setLong(READER_VERTICES, 5);

  // Setup pathes for temporary files
  Path zookeeperDir = getTempPath("_bspZooKeeper");
  Path zkManagerDir = getTempPath("_defaultZkManagerDir");
  Path checkPointDir = getTempPath("_checkpoints");

  // We might start several jobs per test, so we need to clean up here
  FileUtils.deletePath(conf, zookeeperDir);
  FileUtils.deletePath(conf, zkManagerDir);
  FileUtils.deletePath(conf, checkPointDir);

  conf.set(GiraphConstants.ZOOKEEPER_DIR, zookeeperDir.toString());
  GiraphConstants.ZOOKEEPER_MANAGER_DIRECTORY.set(conf,
      zkManagerDir.toString());
  GiraphConstants.CHECKPOINT_DIRECTORY.set(conf, checkPointDir.toString());

  return conf;
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:50,代码来源:BspCase.java


注:本文中的org.apache.giraph.job.GiraphJob.getConfiguration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。