You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@giraph.apache.org by "Jakob Homan (Created) (JIRA)" <ji...@apache.org> on 2011/10/10 22:58:30 UTC

[jira] [Created] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Provide unit testing tool for Giraph algorithms
-----------------------------------------------

                 Key: GIRAPH-51
                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
             Project: Giraph
          Issue Type: Improvement
            Reporter: Jakob Homan


It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Jakob Homan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13149805#comment-13149805 ] 

Jakob Homan commented on GIRAPH-51:
-----------------------------------

Looks great.  A few comments:
* It may make sense to move InternalVertexRunner to the src tree rather than test tree, since it's a user-facing class rather than something for Giraph's internal testing.  I can imagine us generating a separate test jar soon and we'd want this class in the regular jar we ship to end users.
* Is it necessary to specify the input and output formats and to write data out to the file system? In general a vertex implementation should be able to work with reasonable vertices from any input source (part of the GIRAPH-64 work). If the internal vertex runner just fed the values into the compute method we'd save file io and coupling of specific formats.
* Can you add javadoc for the public methods?
* It looks like the ZooKeeper exceptions are probably race conditions.  I see similar ones during regular test execution.  It would be nice to remove the need for ZooKeeper on these types of tests: if one is spinning up ZK, it's not really a unit test any more, and it should be possible to test vertex implementations without it.  One should be able to just feed input state (vertices, edges, superstep #, etc.) and verify the output state without every actually spinning up any of the distributed infrastructure.  But that's probably best done in another JIRA.  I don't think the ZK exceptions are something to be concerned about.
                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>         Attachments: GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Jakob Homan (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Homan updated GIRAPH-51:
------------------------------

    Assignee: Sebastian Schelter
    
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>            Assignee: Sebastian Schelter
>         Attachments: GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Jakob Homan (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jakob Homan resolved GIRAPH-51.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 0.70.0

I've committed this.  Thanks for the contribution, Sebastian!
                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>            Assignee: Sebastian Schelter
>             Fix For: 0.70.0
>
>         Attachments: GIRAPH-51-2.patch, GIRAPH-51-3.patch, GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Sebastian Schelter (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Schelter updated GIRAPH-51:
-------------------------------------

    Attachment: GIRAPH-51-3.patch

fixed the javadoc errors in the patch
                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>            Assignee: Sebastian Schelter
>         Attachments: GIRAPH-51-2.patch, GIRAPH-51-3.patch, GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Sebastian Schelter (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Schelter updated GIRAPH-51:
-------------------------------------

    Attachment: GIRAPH-51-2.patch

Hi Jakob,

I moved InternalVertexRunner to the src as you suggested.

I think we have to separate the unit tests into two categories:

The first one would be testing single methods, usually invoking compute() and verifying the behavior of the vertex (I suppose that's what you aimed at with your last comment). To accomplish that one need not really run the system, it should be sufficient to injected mocked dependencies.  I added two tests for SimpleShortestPathVertex as an example for such tests. I created a helper class for convenient mocking of dependencies like the hadoop configuration e.g. and for configuring the vertex.

The second category, which InternalVertexRunner aims at would be something like a local "integration" test on toy data. It runs the system in a single JVM and executes the whole lifecycle of an algorithm (reading input from disk, running the supersteps, writing output etc). Although these tests are no compensation for real integration testing, they are often very helpful in finding subtle bugs, that normal unit testing cannot discover.


                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>            Assignee: Sebastian Schelter
>         Attachments: GIRAPH-51-2.patch, GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Sebastian Schelter (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13124553#comment-13124553 ] 

Sebastian Schelter commented on GIRAPH-51:
------------------------------------------

It would be great to have something like this, I have my students look at giraph currently and one of their first problems was how to write a simple unit case for some algorithm they wanna implement.
                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Jakob Homan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13155357#comment-13155357 ] 

Jakob Homan commented on GIRAPH-51:
-----------------------------------

bq. I think we have to separate the unit tests into two categories:
Excellent summary. Totally agree.

Patch looks great. Barring a couple minor things, I think it's ready to go:
* Need completed javadoc for MockUtils::prepareVertex()
* Javadoc typo in ReflectionUtils::setField: /**t ry -> /** try
* Javadoc typo in ReflectionUtils::findDeclaredField: it's -> its
* Javadoc typo in MockUtils::MockedEnvironment: enviroment -> environment

                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>            Assignee: Sebastian Schelter
>         Attachments: GIRAPH-51-2.patch, GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13158771#comment-13158771 ] 

Hudson commented on GIRAPH-51:
------------------------------

Integrated in Giraph-trunk-Commit #44 (See [https://builds.apache.org/job/Giraph-trunk-Commit/44/])
    GIRAPH-51. Provide unit testing tool for Giraph algorithms. Contributed by Sebastian Schelter.

jghoman : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1207593
Files : 
* /incubator/giraph/trunk/CHANGELOG
* /incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/GiraphJob.java
* /incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/GraphMapper.java
* /incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/InternalVertexRunner.java
* /incubator/giraph/trunk/src/main/java/org/apache/giraph/utils/ReflectionUtils.java
* /incubator/giraph/trunk/src/test/java/org/apache/giraph/examples
* /incubator/giraph/trunk/src/test/java/org/apache/giraph/examples/SimpleShortestPathVertexTest.java
* /incubator/giraph/trunk/src/test/java/org/apache/giraph/utils
* /incubator/giraph/trunk/src/test/java/org/apache/giraph/utils/MockUtils.java

                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>            Assignee: Sebastian Schelter
>             Fix For: 0.70.0
>
>         Attachments: GIRAPH-51-2.patch, GIRAPH-51-3.patch, GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Sebastian Schelter (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebastian Schelter updated GIRAPH-51:
-------------------------------------

    Attachment: GIRAPH-51.patch

Hi, I'm currently trying to find a way to easily unit test giraph algorithms as suggested here. I plan to implement some complicated stuff on top of Giraph and definitely need this functionality for debugging and development.

I want to be able to repeatedly run a Vertex class in a unit test from my IDE without having to cleanup directories or rely on an external zookeeper instance.

I managed to get a working prototype of a class that can internally run a Vertex. I had to add configuration options to disable the starting of a zookeeper instance via ProcessBuilder in ZooKeeperManager as this didn't work out of my IDE (Intellij). My testing class simply starts its own zookeeper in an extra thread for the duration of the test. This works pretty well and I was already able to unit the SimpleShortestPathVertex. 

Although everything seems to work, I'm still getting some strange warnings from the local zookeeper instance. As I'm not that familiar with zookeeper yet, I wanted ask here whether these warning can simply be ignored?

{quote}
11/11/11 09:55:16 INFO server.PrepRequestProcessor: Got user-level KeeperException when processing sessionid:0x13391d6887b0001 type:create cxid:0x1 zxid:0xfffffffffffffffe txntype:unknown reqpath:n/a Error Path:/_hadoopBsp/job_local_0001 Error:KeeperErrorCode = NoNode for /_hadoopBsp/job_local_0001
{quote}

{quote}
WARN graph.BspService: process: Unknown and unprocessed event (path=/_hadoopBsp/job_local_0001/_applicationAttemptsDir/0/_superstepDir, type=NodeChildrenChanged, state=SyncConnected)
{quote}

Already putting up a first patch for clarity.

Best,
Sebastian

                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>         Attachments: GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (GIRAPH-51) Provide unit testing tool for Giraph algorithms

Posted by "Jakob Homan (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GIRAPH-51?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13158743#comment-13158743 ] 

Jakob Homan commented on GIRAPH-51:
-----------------------------------

+1.
                
> Provide unit testing tool for Giraph algorithms
> -----------------------------------------------
>
>                 Key: GIRAPH-51
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-51
>             Project: Giraph
>          Issue Type: Improvement
>            Reporter: Jakob Homan
>            Assignee: Sebastian Schelter
>         Attachments: GIRAPH-51-2.patch, GIRAPH-51-3.patch, GIRAPH-51.patch
>
>
> It would be nice to have a little tool, similar to MRUnit, that would allow Giraph application writers to quickly unit test their algorithms.  The tool could take a Vertex implementation, a set of input and expected output and verify that after the specified number of supersteps, we've gotten what we expect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira