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


Java GiraphJob.run方法代码示例

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


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

示例1: runZooKeeperAndJob

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
/**
 * Run the ZooKeeper in-process and the job.
 *
 * @param zookeeperConfig Quorum peer configuration
 * @param giraphJob       Giraph job to run
 * @return True if successful, false otherwise
 */
private static boolean runZooKeeperAndJob(
        final ZookeeperConfig zookeeperConfig,
        GiraphJob giraphJob) throws IOException {
    final InProcessZooKeeperRunner.ZooKeeperServerRunner zookeeper =
            new InProcessZooKeeperRunner.ZooKeeperServerRunner();

    int port = zookeeper.start(zookeeperConfig);

    LOG.info("Started test zookeeper on port " + port);
    GiraphConstants.ZOOKEEPER_LIST.set(giraphJob.getConfiguration(),
            "localhost:" + port);
    try {
        return giraphJob.run(true);
    } catch (InterruptedException |
            ClassNotFoundException | IOException e) {
        LOG.error("runZooKeeperAndJob: Got exception on running", e);
    } finally {
        zookeeper.stop();
    }

    return false;
}
 
开发者ID:rayokota,项目名称:hgraphdb,代码行数:30,代码来源:InternalHBaseVertexRunner.java

示例2: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override
public int run(String[] args) throws Exception {
	if (null == getConf()) {
		conf = new Configuration();
	}
	GiraphConfiguration giraphConf = new GiraphConfiguration(getConf());
	CommandLine cmd = ConfigurationUtils.parseArgs(giraphConf, args);

	if (null == cmd) {
		return 0;
	}
	final String vertexClassName = args[0];
	final String jobName = "Giraph: " + vertexClassName;

	GiraphJob job = new GiraphJob(giraphConf, jobName);
	prepareHadoopMRJob(job, cmd);
	boolean verbose = !cmd.hasOption('q');

	return job.run(verbose) ? 0 : -1;
}
 
开发者ID:tayllan,项目名称:comparative-study-of-frameworks-for-parallel-processing-of-graphs,代码行数:21,代码来源:MeuGiraphRunner.java

示例3: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override
public int run(String[] args) throws Exception {
	if (null == getConf()) {
		conf = new Configuration();
	}
	GiraphConfiguration giraphConf = new GiraphConfiguration(getConf());
	CommandLine cmd = ConfigurationUtils.parseArgs(giraphConf, args);

	if (null == cmd) {
		return 0;
	}
	final String vertexClassName = args[0];
	final String jobName = "Giraph: " + vertexClassName;

	giraphConf.setMaxNumberOfSupersteps(MAX_NUMBER_SUPERSTEPS);

	GiraphJob job = new GiraphJob(giraphConf, jobName);
	prepareHadoopMRJob(job, cmd);
	boolean verbose = !cmd.hasOption('q');

	return job.run(verbose) ? 0 : -1;
}
 
开发者ID:tayllan,项目名称:comparative-study-of-frameworks-for-parallel-processing-of-graphs,代码行数:23,代码来源:MeuGiraphRunner.java

示例4: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override
public int run(String[] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException(
        "run: Must have 2 arguments <output path> <# of workers>");
  }
  GiraphJob job = new GiraphJob(getConf(), getClass().getName());
  job.getConfiguration().setVertexClass(SimpleVertex.class);
  job.getConfiguration().setVertexInputFormatClass(
      SimpleSuperstepVertexInputFormat.class);
  job.getConfiguration().setWorkerContextClass(EmitterWorkerContext.class);
  job.getConfiguration().set(
      SimpleVertexWithWorkerContext.OUTPUTDIR, args[0]);
  job.getConfiguration().setWorkerConfiguration(Integer.parseInt(args[1]),
      Integer.parseInt(args[1]),
      100.0f);
  if (job.run(true)) {
    return 0;
  } else {
    return -1;
  }
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:23,代码来源:SimpleVertexWithWorkerContext.java

示例5: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override
public int run(String[] args) throws Exception {
  if (args.length != 2) {
    throw new IllegalArgumentException(
        "run: Must have 2 arguments <output path> <# of workers>");
  }
  GiraphJob job = new GiraphJob(getConf(), getClass().getName());
  job.getConfiguration().setComputationClass(SimpleComputation.class);
  job.getConfiguration().setVertexInputFormatClass(
      SimpleSuperstepVertexInputFormat.class);
  job.getConfiguration().setWorkerContextClass(EmitterWorkerContext.class);
  job.getConfiguration().set(
      SimpleVertexWithWorkerContext.OUTPUTDIR, args[0]);
  job.getConfiguration().setWorkerConfiguration(Integer.parseInt(args[1]),
      Integer.parseInt(args[1]),
      100.0f);
  if (job.run(true)) {
    return 0;
  } else {
    return -1;
  }
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:23,代码来源:SimpleVertexWithWorkerContext.java

示例6: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override public int run(String[] args) throws Exception {
  args = HiveJythonUtils.processArgs(args, CONF);
  LOG.info("Processed hive options now have args: " + Arrays.toString(args));

  HiveIO.init(CONF, false);

  PythonInterpreter interpreter = new PythonInterpreter();

  JythonJob jythonJob = parseJythonFiles(interpreter, args);

  logOptions();

  for (String arg : args) {
    Path remoteScriptPath = copyAndAdd(new Path(arg), CONF);
    ScriptLoader.addScriptToLoad(CONF, remoteScriptPath.toString(),
        DeployType.DISTRIBUTED_CACHE, Language.JYTHON);
  }

  String name = HiveJythonUtils.writeJythonJobToConf(jythonJob, CONF,
     interpreter);

  GiraphJob job = new GiraphJob(CONF, name);
  return job.run(true) ? 0 : -1;
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:25,代码来源:HiveJythonRunner.java

示例7: 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

示例8: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override
/**
 * Drives a job run configured for "Giraph on Hadoop MR cluster"
 * @param args the command line arguments
 * @return job run exit code
 */
public int run(String[] args) throws Exception {
  if (null == getConf()) { // for YARN profile
    conf = new Configuration();
  }
  GiraphConfiguration giraphConf = new GiraphConfiguration(getConf());
  CommandLine cmd = ConfigurationUtils.parseArgs(giraphConf, args);
  if (null == cmd) {
    return 0; // user requested help/info printout, don't run a job.
  }

  // set up job for various platforms
  final String vertexClassName = args[0];
  final String jobName = "Giraph: " + vertexClassName;
  /*if[PURE_YARN]
  GiraphYarnClient job = new GiraphYarnClient(giraphConf, jobName);
  else[PURE_YARN]*/
  GiraphJob job = new GiraphJob(giraphConf, jobName);
  prepareHadoopMRJob(job, cmd);
  /*end[PURE_YARN]*/

  // run the job, collect results
  if (LOG.isDebugEnabled()) {
    LOG.debug("Attempting to run Vertex: " + vertexClassName);
  }
  boolean verbose = !cmd.hasOption('q');
  return job.run(verbose) ? 0 : -1;
}
 
开发者ID:renato2099,项目名称:giraph-gora,代码行数:34,代码来源:GiraphRunner.java

示例9: main

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    
	if (args.length != 3) {
		System.out.println("Componentisation Help:");
		System.out.println("Parameters: <numbersOfWorkers> <inputLocation> <outputLocation>");
		System.out.println("Example: 1 inputFolder outputFolder");
		return;
	}
	
	String numberOfWorkers = args[0];
	String inputLocation = args[1];
	String outputLocation = args[2];
	
    GiraphJob bspJob = new GiraphJob(new Configuration(), Job.class.getName());
    
    bspJob.getConfiguration().setVertexClass(ComponentisationVertex.class);
    bspJob.getConfiguration().setVertexInputFormatClass(InputFormat.class);
    GiraphFileInputFormat.addVertexInputPath(bspJob.getConfiguration(), new Path(inputLocation));
    
    bspJob.getConfiguration().setVertexOutputFormatClass(OutputFormat.class);
    
    int minWorkers = Integer.parseInt(numberOfWorkers);
    int maxWorkers = Integer.parseInt(numberOfWorkers);
    bspJob.getConfiguration().setWorkerConfiguration(minWorkers, maxWorkers, 100.0f);

    FileOutputFormat.setOutputPath(bspJob.getInternalJob(),
                                   new Path(outputLocation));
    boolean verbose = true;
    
    if (bspJob.run(verbose)) {
      System.out.println("Ended well");
    } else {
      System.out.println("Ended with Failure");
    }

}
 
开发者ID:paulmw,项目名称:giraph-examples,代码行数:37,代码来源:Job.java

示例10: main

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    
	if (args.length != 3) {
		System.out.println("Componentisation Help:");
		System.out.println("Parameters: Componentisation <numbersOfWorkers> <inputLocaiton> <outputLocation>");
		System.out.println("Example: Componentisation 1 inputFolder outputFolder");
		return;
	}
	
	String numberOfWorkers = args[0];
	String inputLocation = args[1];
	String outputLocation = args[2];
	
    GiraphJob bspJob = new GiraphJob(new Configuration(), Job.class.getName());
    
    bspJob.getConfiguration().setVertexClass(TrianglesVertex.class);
    bspJob.getConfiguration().setVertexInputFormatClass(InputFormat.class);
    GiraphFileInputFormat.addVertexInputPath(bspJob.getConfiguration(), new Path(inputLocation));
    
    bspJob.getConfiguration().setVertexOutputFormatClass(OutputFormat.class);
    
    int minWorkers = Integer.parseInt(numberOfWorkers);
    int maxWorkers = Integer.parseInt(numberOfWorkers);
    bspJob.getConfiguration().setWorkerConfiguration(minWorkers, maxWorkers, 100.0f);

    FileOutputFormat.setOutputPath(bspJob.getInternalJob(),
                                   new Path(outputLocation));
    boolean verbose = true;
    
    if (bspJob.run(verbose)) {
      System.out.println("Ended well");
    } else {
      System.out.println("Ended with Failure");
    }

}
 
开发者ID:paulmw,项目名称:giraph-examples,代码行数:37,代码来源:Job.java

示例11: main

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    
	if (args.length != 4) {
		System.out.println("KTrusses Help:");
		System.out.println("Parameters: <numbersOfWorkers> <inputLocation> <outputLocation> <k>");
		System.out.println("Example: 1 inputFolder outputFolder 4");
		return;
	}
	
	String numberOfWorkers = args[0];
	String inputLocation = args[1];
	String outputLocation = args[2];
	int k = Integer.parseInt(args[3]);
	
    GiraphJob bspJob = new GiraphJob(new Configuration(), Job.class.getName());
    
    bspJob.getConfiguration().setVertexClass(KTrussVertex.class);
    bspJob.getConfiguration().setVertexInputFormatClass(InputFormat.class);
    GiraphFileInputFormat.addVertexInputPath(bspJob.getConfiguration(), new Path(inputLocation));
    bspJob.getConfiguration().setMasterComputeClass(MasterCompute.class);
    bspJob.getConfiguration().setVertexOutputFormatClass(OutputFormat.class);
    
    int minWorkers = Integer.parseInt(numberOfWorkers);
    int maxWorkers = Integer.parseInt(numberOfWorkers);
    bspJob.getConfiguration().setWorkerConfiguration(minWorkers, maxWorkers, 100.0f);

    bspJob.getConfiguration().setInt(Constants.K, k);
    
    FileOutputFormat.setOutputPath(bspJob.getInternalJob(),
                                   new Path(outputLocation));
    boolean verbose = true;
    
    if (bspJob.run(verbose)) {
      System.out.println("Ended well");
    } else {
      System.out.println("Ended with Failure");
    }

}
 
开发者ID:paulmw,项目名称:giraph-examples,代码行数:40,代码来源:Job.java

示例12: main

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    
	if (args.length != 3) {
		System.out.println("KCore Help:");
		System.out.println("Parameters: <numbersOfWorkers> <inputLocation> <outputLocation>");
		System.out.println("Example: 1 inputFolder outputFolder");
		return;
	}
	
	String numberOfWorkers = args[0];
	String inputLocation = args[1];
	String outputLocation = args[2];
	
    GiraphJob bspJob = new GiraphJob(new Configuration(), Job.class.getName());
    
    bspJob.getConfiguration().setVertexClass(KCoreVertex.class);
    bspJob.getConfiguration().setVertexInputFormatClass(InputFormat.class);
    GiraphFileInputFormat.addVertexInputPath(bspJob.getConfiguration(), new Path(inputLocation));
    
    bspJob.getConfiguration().setVertexOutputFormatClass(OutputFormat.class);
    
    int minWorkers = Integer.parseInt(numberOfWorkers);
    int maxWorkers = Integer.parseInt(numberOfWorkers);
    bspJob.getConfiguration().setWorkerConfiguration(minWorkers, maxWorkers, 100.0f);

    FileOutputFormat.setOutputPath(bspJob.getInternalJob(),
                                   new Path(outputLocation));
    boolean verbose = true;
    
    if (bspJob.run(verbose)) {
      System.out.println("Ended well");
    } else {
      System.out.println("Ended with Failure");
    }

}
 
开发者ID:paulmw,项目名称:giraph-examples,代码行数:37,代码来源:Job.java

示例13: main

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    
	if (args.length != 3) {
		System.out.println("Componentisation Help:");
		System.out.println("Parameters: <numbersOfWorkers> <inputLocation> <outputLocation>");
		System.out.println("Example: 1 inputFolder outputFolder");
		return;
	}
	
	String numberOfWorkers = args[0];
	String inputLocation = args[1];
	String outputLocation = args[2];
	
    GiraphJob bspJob = new GiraphJob(new Configuration(), Job.class.getName());
    
    bspJob.getConfiguration().setVertexClass(WordCountVertex.class);
    bspJob.getConfiguration().setEdgeInputFormatClass(InputFormat.class);
    GiraphFileInputFormat.addEdgeInputPath(bspJob.getConfiguration(), new Path(inputLocation));
    
    bspJob.getConfiguration().setVertexOutputFormatClass(OutputFormat.class);
    
    int minWorkers = Integer.parseInt(numberOfWorkers);
    int maxWorkers = Integer.parseInt(numberOfWorkers);
    bspJob.getConfiguration().setWorkerConfiguration(minWorkers, maxWorkers, 100.0f);

    FileOutputFormat.setOutputPath(bspJob.getInternalJob(),
                                   new Path(outputLocation));
    boolean verbose = true;
    
    if (bspJob.run(verbose)) {
      System.out.println("Ended well");
    } else {
      System.out.println("Ended with Failure");
    }

}
 
开发者ID:paulmw,项目名称:giraph-examples,代码行数:37,代码来源:Job.java

示例14: main

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    
	if (args.length != 4) {
		System.out.println("KMeans Help:");
		System.out.println("Parameters: <numbersOfWorkers> <inputLocation> <outputLocation> <k>");
		System.out.println("Example: 1 inputFolder outputFolder 3");
		return;
	}
	
	String numberOfWorkers = args[0];
	String inputLocation = args[1];
	String outputLocation = args[2];
	int k = Integer.parseInt(args[3]);
	
    GiraphJob bspJob = new GiraphJob(new Configuration(), Job.class.getName());
    
    bspJob.getConfiguration().setInt(Constants.K, k);
    
    bspJob.getConfiguration().setVertexClass(KMeansVertex.class);
    bspJob.getConfiguration().setMasterComputeClass(MasterCompute.class);
    bspJob.getConfiguration().setVertexInputFormatClass(InputFormat.class);
    GiraphFileInputFormat.addVertexInputPath(bspJob.getConfiguration(), new Path(inputLocation));
    
    bspJob.getConfiguration().setVertexOutputFormatClass(OutputFormat.class);
    
    int minWorkers = Integer.parseInt(numberOfWorkers);
    int maxWorkers = Integer.parseInt(numberOfWorkers);
    bspJob.getConfiguration().setWorkerConfiguration(minWorkers, maxWorkers, 100.0f);

    FileOutputFormat.setOutputPath(bspJob.getInternalJob(),
                                   new Path(outputLocation));
    boolean verbose = true;
    
    if (bspJob.run(verbose)) {
      System.out.println("Ended well");
    } else {
      System.out.println("Ended with Failure");
    }

}
 
开发者ID:paulmw,项目名称:giraph-examples,代码行数:41,代码来源:Job.java

示例15: run

import org.apache.giraph.job.GiraphJob; //导入方法依赖的package包/类
@Override
/**
 * Drives a job run configured for "Giraph on Hadoop MR cluster"
 * @param args the command line arguments
 * @return job run exit code
 */
public int run(String[] args) throws Exception {
  if (null == getConf()) { // for YARN profile
    conf = new Configuration();
  }
  GiraphConfiguration giraphConf = new GiraphConfiguration(getConf());
  CommandLine cmd = ConfigurationUtils.parseArgs(giraphConf, args);
  if (null == cmd) {
    return 0; // user requested help/info printout, don't run a job.
  }

  // set up job for various platforms
  final String vertexClassName = args[0];
  final String jobName = "Giraph: " + vertexClassName;
  


  GiraphJob job = new GiraphJob(giraphConf, jobName);
  prepareHadoopMRJob(job, cmd);
  

  // run the job, collect results
  if (LOG.isDebugEnabled()) {
    LOG.debug("Attempting to run Vertex: " + vertexClassName);
  }
  boolean verbose = !cmd.hasOption('q');
  return job.run(verbose) ? 0 : -1;
}
 
开发者ID:zfighter,项目名称:giraph-research,代码行数:34,代码来源:GiraphRunner.java


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