Hello Anna,

I use two ways to run a Giraph job for testing. The one is to setup a
single node cluster (there are many tutorials on that) and run your job via
the command line.

The other way (through NetBeans) is Junit testing. Add those lines to your
pom:

<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
</dependency>

Then create a test package in your netbeans project. Normally there are two
directories under your_root/src called "main" and "test". If there isn't
one named "test", you should create and structure it normally, like the
other one (add "java" and "resources" directories, packages, etc.). After
that you will be able to see it through your IDE as well, and manage it
like the main package. Finally, you can write Junit tests. Create a class
called "Tests.java" or whatever else you want, and write methods in it
using the @Test annotation. For example:

@Test
public void yourTestFunction() throws Exception {

    String[] tinyGraph = {
        "1 2", "1 3",
        "2 1", "2 4",
        "3 1", "3 4",
        "4 2", "4 3", "4 5", "4 6",
        "5 4", "5 7",
        "6 4", "6 7",
        "7 5", "7 6"
    };

    // This is where you configure your job
    GiraphConfiguration conf = new GiraphConfiguration();
    conf.setComputationClass();
    conf.setMasterComputeClass();
    conf.setEdgeInputFormatClass();
    conf.setVertexInputFormatClass();
    conf.setVertexOutputFormatClass();

    // Run and print results
    Iterable<String> results = InternalVertexRunner.run(conf, tinyGraph,
tinyGraph);
    for (String result : results) {
        LOGGER.debug(result);
    }

}

Note that the tests will run every time you compile it, unless you specify
-DskipTests in the mvn command.
Regards,
Panagiotis Eustratiadis.


On 22 May 2015 at 15:43, Anna Xenaki <axen...@mail.ntua.gr> wrote:

> Hi, sorry for the inconvenience I found your mail via giraph mailing list.
> Im new in Giraph.
> I want to run a giraph job via netbeans. I have imported all libs in
> project , and installed hadoop 2.5.2 Giraph 1.1.0 in ubuntu 14.04.
> I created Java classes FbGraphInputFormat, FbGraphMessage,
> FbGraphOutputFormat,FbGraphState, KatzReduce
>
> public class KatzReduce extends BasicComputation<Text, FbGraphState,
> DoubleWritable, FbGraphMessage> {
> public class FbGraphState implements Writable {
> public class FbGraphOutputFormat  extends
> TextVertexOutputFormat<Text,FbGraphState,DoubleWritable>{
> public class FbGraphInputFormat extends TextVertexInputFormat<Text,
> FbGraphState, DoubleWritable> {
> class FbGraphMessage implements Writable{
>
>
> MY QUESTION is simple I want to run my java project from netbeans I dont
> know how . I dont have a main class and do not know to start a giraph job
> that does exactly what KatzReduce.java says.
>
> I added in the run of the project the arguments infile_location_path
> outfile_location_path
>
> Do I create a main method saying what? I cannot find any documentation on
> deploying giraph projects from scratch so any help would be of great
> assistance.
>
> Thanks in advance, Anna
>

Reply via email to