You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by ok...@apache.org on 2016/10/29 23:01:18 UTC
[01/10] tinkerpop git commit:
TraversalStrategy.GlobalCache.getStrategies() is now the point where static{}
code blocks are loaded for Graph and GraphComputer classes. Added a test case
to TraversalStrategiesTset that demonstrates that the GlobalCache ca
Repository: tinkerpop
Updated Branches:
refs/heads/master f4b271412 -> ce1099d79
TraversalStrategy.GlobalCache.getStrategies() is now the point where static{} code blocks are loaded for Graph and GraphComputer classes. Added a test case to TraversalStrategiesTset that demonstrates that the GlobalCache can be manipulated without fear of static{} re-registering strategies. This is a much much safer model and, moreover, proved correct via testing.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/f9bf0444
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/f9bf0444
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/f9bf0444
Branch: refs/heads/master
Commit: f9bf0444e4bfe09dcea9b8dc05870ddaec4b6180
Parents: 285ff35
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 25 13:02:29 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 25 13:02:29 2016 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../decoration/VertexProgramStrategy.java | 5 -
.../process/traversal/TraversalStrategies.java | 11 +-
.../process/TraversalStrategiesTest.java | 194 ++++++++++++++++++-
4 files changed, 200 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index a281c38..1c7441b 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Added a class loader to `TraversalStrategies.GlobalCache` which guarantees strategies are registered prior to `GlobalCache.getStrategies()`.
* Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
[[release-3-2-3]]
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
index 0eeae3c..89e40cb 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/traversal/strategy/decoration/VertexProgramStrategy.java
@@ -171,11 +171,6 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
}
} else
graphComputerClass = this.computer.getGraphComputerClass();
- try {
- Class.forName(graphComputerClass.getCanonicalName());
- } catch (final ClassNotFoundException e) {
- throw new IllegalStateException(e.getMessage(), e);
- }
final List<TraversalStrategy<?>> graphComputerStrategies = TraversalStrategies.GlobalCache.getStrategies(graphComputerClass).toList();
traversalSource.getStrategies().addStrategies(graphComputerStrategies.toArray(new TraversalStrategy[graphComputerStrategies.size()]));
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
index c271a37..015df70 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/TraversalStrategies.java
@@ -225,7 +225,6 @@ public interface TraversalStrategies extends Serializable, Cloneable {
OrderLimitStrategy.instance(),
PathProcessorStrategy.instance(),
ComputerVerificationStrategy.instance());
-
GRAPH_COMPUTER_CACHE.put(GraphComputer.class, graphComputerStrategies);
}
@@ -239,6 +238,16 @@ public interface TraversalStrategies extends Serializable, Cloneable {
}
public static TraversalStrategies getStrategies(final Class graphOrGraphComputerClass) {
+ try {
+ // be sure to load the class so that its static{} traversal strategy registration component is loaded.
+ // this is more important for GraphComputer classes as they are typically not instantiated prior to strategy usage like Graph classes.
+ final String graphComputerClassName = null != graphOrGraphComputerClass.getDeclaringClass() ?
+ graphOrGraphComputerClass.getCanonicalName().replace("." + graphOrGraphComputerClass.getSimpleName(), "$" + graphOrGraphComputerClass.getSimpleName()) :
+ graphOrGraphComputerClass.getCanonicalName();
+ Class.forName(graphComputerClassName);
+ } catch (final ClassNotFoundException e) {
+ throw new IllegalStateException(e.getMessage(), e);
+ }
if (Graph.class.isAssignableFrom(graphOrGraphComputerClass)) {
final TraversalStrategies traversalStrategies = GRAPH_CACHE.get(graphOrGraphComputerClass);
return null == traversalStrategies ? GRAPH_CACHE.get(Graph.class) : traversalStrategies;
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/f9bf0444/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
index f316836..3d320db 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
@@ -18,26 +18,211 @@
*/
package org.apache.tinkerpop.gremlin.process;
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.apache.tinkerpop.gremlin.process.computer.ComputerResult;
+import org.apache.tinkerpop.gremlin.process.computer.GraphComputer;
+import org.apache.tinkerpop.gremlin.process.computer.MapReduce;
+import org.apache.tinkerpop.gremlin.process.computer.VertexProgram;
import org.apache.tinkerpop.gremlin.process.traversal.Traversal;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies;
import org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategy;
import org.apache.tinkerpop.gremlin.process.traversal.strategy.AbstractTraversalStrategy;
+import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.apache.tinkerpop.gremlin.structure.Graph;
+import org.apache.tinkerpop.gremlin.structure.Transaction;
+import org.apache.tinkerpop.gremlin.structure.Vertex;
import org.junit.Test;
-import java.util.Arrays;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Future;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
/**
* @author Matthias Broecheler (me@matthiasb.com)
*/
public class TraversalStrategiesTest {
+ @Test
+ public void shouldAllowUserManipulationOfGlobalCache() throws Exception {
+ ///////////
+ // GRAPH //
+ ///////////
+ TestGraph graph = new TestGraph();
+ TraversalStrategies strategies = graph.traversal().getStrategies();
+ assertFalse(TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList().isEmpty());
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()) {
+ assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class).toList()) {
+ assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ assertTrue(strategies.getStrategy(StrategyA.class).isPresent());
+ assertTrue(strategies.getStrategy(StrategyB.class).isPresent());
+ assertFalse(strategies.getStrategy(StrategyC.class).isPresent());
+ assertFalse(strategies.getStrategy(StrategyD.class).isPresent());
+ strategies.addStrategies(new StrategyD());
+ strategies.removeStrategies(StrategyA.class);
+ assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+ assertTrue(strategies.getStrategy(StrategyD.class).isPresent());
+ ///
+ graph = new TestGraph();
+ strategies = graph.traversal().getStrategies();
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(Graph.class).toList()) {
+ assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class).toList()) {
+ assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+ assertTrue(strategies.getStrategy(StrategyB.class).isPresent());
+ assertFalse(strategies.getStrategy(StrategyC.class).isPresent());
+ assertTrue(strategies.getStrategy(StrategyD.class).isPresent());
+ //////////////////////
+ /// GRAPH COMPUTER ///
+ //////////////////////
+ strategies = TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class);
+ assertFalse(TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList().isEmpty());
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList()) {
+ assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraph.class).toList()) {
+ assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+ assertFalse(strategies.getStrategy(StrategyB.class).isPresent());
+ assertTrue(strategies.getStrategy(StrategyC.class).isPresent());
+ strategies.addStrategies(new StrategyE());
+ strategies.removeStrategies(StrategyC.class);
+ //
+ strategies = TraversalStrategies.GlobalCache.getStrategies(TestGraphComputer.class);
+ assertFalse(TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList().isEmpty());
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).toList()) {
+ assertTrue(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ for (final TraversalStrategy strategy : TraversalStrategies.GlobalCache.getStrategies(TestGraph.class).toList()) {
+ assertFalse(strategies.getStrategy(strategy.getClass()).isPresent());
+ }
+ assertFalse(strategies.getStrategy(StrategyA.class).isPresent());
+ assertFalse(strategies.getStrategy(StrategyB.class).isPresent());
+ assertFalse(strategies.getStrategy(StrategyC.class).isPresent());
+ assertFalse(strategies.getStrategy(StrategyD.class).isPresent());
+ assertTrue(strategies.getStrategy(StrategyE.class).isPresent());
+ }
+
+ public static class TestGraphComputer implements GraphComputer {
+
+ static {
+ TraversalStrategies.GlobalCache.registerStrategies(TestGraphComputer.class,
+ TraversalStrategies.GlobalCache.getStrategies(GraphComputer.class).clone().addStrategies(new StrategyC()));
+ }
+
+ @Override
+ public GraphComputer result(ResultGraph resultGraph) {
+ return this;
+ }
+
+ @Override
+ public GraphComputer persist(Persist persist) {
+ return this;
+ }
+
+ @Override
+ public GraphComputer program(VertexProgram vertexProgram) {
+ return this;
+ }
+
+ @Override
+ public GraphComputer mapReduce(MapReduce mapReduce) {
+ return this;
+ }
+
+ @Override
+ public GraphComputer workers(int workers) {
+ return this;
+ }
+
+ @Override
+ public GraphComputer vertices(Traversal<Vertex, Vertex> vertexFilter) throws IllegalArgumentException {
+ return this;
+ }
+
+ @Override
+ public GraphComputer edges(Traversal<Vertex, Edge> edgeFilter) throws IllegalArgumentException {
+ return this;
+ }
+
+ @Override
+ public Future<ComputerResult> submit() {
+ return new CompletableFuture<>();
+ }
+ }
+
+ public static class TestGraph implements Graph {
+
+ static {
+ TraversalStrategies.GlobalCache.registerStrategies(TestGraph.class,
+ TraversalStrategies.GlobalCache.getStrategies(Graph.class).clone().addStrategies(new StrategyA(), new StrategyB()));
+ }
+
+ @Override
+ public Vertex addVertex(Object... keyValues) {
+ return null;
+ }
+
+ @Override
+ public <C extends GraphComputer> C compute(Class<C> graphComputerClass) throws IllegalArgumentException {
+ return (C) new TestGraphComputer();
+ }
+
+ @Override
+ public GraphComputer compute() throws IllegalArgumentException {
+ return new TestGraphComputer();
+ }
+
+ @Override
+ public Iterator<Vertex> vertices(Object... vertexIds) {
+ return Collections.emptyIterator();
+ }
+
+ @Override
+ public Iterator<Edge> edges(Object... edgeIds) {
+ return Collections.emptyIterator();
+ }
+
+ @Override
+ public Transaction tx() {
+ return null;
+ }
+
+ @Override
+ public void close() throws Exception {
+
+ }
+
+ @Override
+ public Variables variables() {
+ return null;
+ }
+
+ @Override
+ public Configuration configuration() {
+ return new BaseConfiguration();
+ }
+ }
+
/**
* Tests that {@link org.apache.tinkerpop.gremlin.process.traversal.TraversalStrategies#sortStrategies(java.util.List)}
* works as advertised. This class defines a bunch of dummy strategies which define an order. It is verified
@@ -113,7 +298,7 @@ public class TraversalStrategiesTest {
assertTrue(s.indexOf(a) < s.indexOf(b));
// sort and then add more
- s = new ArrayList<>((List)Arrays.asList(b,a,c));
+ s = new ArrayList<>((List) Arrays.asList(b, a, c));
s = TraversalStrategies.sortStrategies(s);
assertEquals(3, s.size());
assertEquals(a, s.get(0));
@@ -220,7 +405,6 @@ public class TraversalStrategiesTest {
}
-
private static class DummyStrategy<S extends TraversalStrategy> extends AbstractTraversalStrategy<S> {
@Override
@@ -262,7 +446,7 @@ public class TraversalStrategiesTest {
assertEquals(e, s.get(3));
//full reverse sorting
- s = Arrays.asList(k,e,d,c,b,a);
+ s = Arrays.asList(k, e, d, c, b, a);
s = TraversalStrategies.sortStrategies(s);
assertEquals(6, s.size());
assertEquals(a, s.get(0));
[10/10] tinkerpop git commit: Merge branch 'tp32'
Posted by ok...@apache.org.
Merge branch 'tp32'
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/ce1099d7
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/ce1099d7
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/ce1099d7
Branch: refs/heads/master
Commit: ce1099d7987deb983283c75635a69d375bdad199
Parents: f4b2714 1eac35b
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:44:14 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:44:14 2016 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 3 +
.../peerpressure/PeerPressureVertexProgram.java | 4 +-
.../decoration/VertexProgramStrategy.java | 5 -
.../process/traversal/TraversalStrategies.java | 11 +-
.../process/traversal/step/map/ProjectStep.java | 4 +
.../process/TraversalStrategiesTest.java | 195 ++++++++++++++++++-
.../process/GroovyProcessComputerSuite.java | 2 +-
.../BulkDumperVertexProgramTest.java | 6 -
.../gremlin/structure/TransactionTest.java | 2 +-
.../spark/process/computer/SparkExecutor.java | 6 +
10 files changed, 217 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/ce1099d7/CHANGELOG.asciidoc
----------------------------------------------------------------------
[02/10] tinkerpop git commit: added authorship to TraversalStrategies
java file.
Posted by ok...@apache.org.
added authorship to TraversalStrategies java file.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/b0bedf6b
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/b0bedf6b
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/b0bedf6b
Branch: refs/heads/master
Commit: b0bedf6b441edddbfd2e005641fee0a044b3b552
Parents: f9bf044
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Tue Oct 25 13:07:01 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Tue Oct 25 13:07:01 2016 -0600
----------------------------------------------------------------------
.../apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/b0bedf6b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
index 3d320db..bb58a06 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/process/TraversalStrategiesTest.java
@@ -52,6 +52,7 @@ import static org.junit.Assert.fail;
/**
* @author Matthias Broecheler (me@matthiasb.com)
+ * @author Marko A. Rodriguez (marko@markorodriguez.com)
*/
public class TraversalStrategiesTest {
[06/10] tinkerpop git commit: Merge branch 'tp32-tests' of
https://github.com/ngageoint/tinkerpop into tp32
Posted by ok...@apache.org.
Merge branch 'tp32-tests' of https://github.com/ngageoint/tinkerpop into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/8ae1a092
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/8ae1a092
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/8ae1a092
Branch: refs/heads/master
Commit: 8ae1a09215560585658cd260cf273591a95795fc
Parents: 1282a7a 7aa9782
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:14:30 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:14:30 2016 -0600
----------------------------------------------------------------------
.../clustering/peerpressure/PeerPressureVertexProgram.java | 4 ++--
.../computer/bulkdumping/BulkDumperVertexProgramTest.java | 6 ------
.../apache/tinkerpop/gremlin/structure/TransactionTest.java | 2 +-
3 files changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
[07/10] tinkerpop git commit: reexposed GroovyPeerPressure
Posted by ok...@apache.org.
reexposed GroovyPeerPressure
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7c1ee367
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7c1ee367
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7c1ee367
Branch: refs/heads/master
Commit: 7c1ee367c9e627c3a1d028a06283b2c5873358d7
Parents: 8ae1a09
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:16:04 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:16:04 2016 -0600
----------------------------------------------------------------------
.../tinkerpop/gremlin/process/GroovyProcessComputerSuite.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c1ee367/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
index f3918b6..e411c1e 100644
--- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
+++ b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java
@@ -148,7 +148,7 @@ public class GroovyProcessComputerSuite extends ProcessComputerSuite {
GroovyOrderTest.Traversals.class,
GroovyPageRankTest.Traversals.class,
GroovyPathTest.Traversals.class,
- // GroovyPeerPressureTest.Traversals.class, (ordering of ids in multi-threaded environments is non-deterministic)
+ GroovyPeerPressureTest.Traversals.class,
GroovyProfileTest.Traversals.class,
GroovyProjectTest.Traversals.class,
GroovyProgramTest.Traversals.class,
[05/10] tinkerpop git commit: added ProjectStep.getProjectKeys() --
should we make this an unmodifiable list.
Posted by ok...@apache.org.
added ProjectStep.getProjectKeys() -- should we make this an unmodifiable list.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1282a7ae
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1282a7ae
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1282a7ae
Branch: refs/heads/master
Commit: 1282a7ae14344ba21664631584be0462c67eba40
Parents: c4682f1
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:12:06 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:12:06 2016 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 1 +
.../gremlin/process/traversal/step/map/ProjectStep.java | 4 ++++
2 files changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1282a7ae/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 48f08ef..baf50a1 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+* Added `ProjectStep.getProjectKeys()` for strategies that rely on such information.
* Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
* Deprecated the "performance" tests in `OptIn`.
* Added `Pick.none` and `Pick.any` to the serializers and importers.
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1282a7ae/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
index 83e095a..3ddd4a6 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/map/ProjectStep.java
@@ -97,6 +97,10 @@ public final class ProjectStep<S, E> extends MapStep<S, Map<String, E>> implemen
this.traversalRing.addTraversal(this.integrateChild(selectTraversal));
}
+ public List<String> getProjectKeys() {
+ return this.projectKeys;
+ }
+
@Override
public Set<TraverserRequirement> getRequirements() {
return this.getSelfAndChildRequirements();
[04/10] tinkerpop git commit: Lazy message scope initialization in
PeerPressureVertexProgram. Remove vertex id checks in
BulkDumperVertexProgramTest. Don't rollback transaction if already closed in
TransactionTest.
Posted by ok...@apache.org.
Lazy message scope initialization in PeerPressureVertexProgram. Remove vertex id checks in BulkDumperVertexProgramTest. Don't rollback transaction if already closed in TransactionTest.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/7aa9782c
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/7aa9782c
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/7aa9782c
Branch: refs/heads/master
Commit: 7aa9782c40300531bf08bd140897b50bcd0acdd1
Parents: 5a16f4c
Author: sjudeng <sj...@users.noreply.github.com>
Authored: Wed Oct 26 16:48:23 2016 -0500
Committer: sjudeng <sj...@users.noreply.github.com>
Committed: Wed Oct 26 16:48:23 2016 -0500
----------------------------------------------------------------------
.../clustering/peerpressure/PeerPressureVertexProgram.java | 4 ++--
.../computer/bulkdumping/BulkDumperVertexProgramTest.java | 6 ------
.../apache/tinkerpop/gremlin/structure/TransactionTest.java | 2 +-
3 files changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
index 56de255..b681807 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/clustering/peerpressure/PeerPressureVertexProgram.java
@@ -58,8 +58,6 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
private MessageScope.Local<?> voteScope = MessageScope.Local.of(__::outE);
private MessageScope.Local<?> countScope = MessageScope.Local.of(new MessageScope.Local.ReverseTraversalSupplier(this.voteScope));
- private final Set<MessageScope> VOTE_SCOPE = new HashSet<>(Collections.singletonList(this.voteScope));
- private final Set<MessageScope> COUNT_SCOPE = new HashSet<>(Collections.singletonList(this.countScope));
public static final String CLUSTER = "gremlin.peerPressureVertexProgram.cluster";
private static final String VOTE_STRENGTH = "gremlin.peerPressureVertexProgram.voteStrength";
@@ -120,6 +118,8 @@ public class PeerPressureVertexProgram extends StaticVertexProgram<Pair<Serializ
@Override
public Set<MessageScope> getMessageScopes(final Memory memory) {
+ final Set<MessageScope> VOTE_SCOPE = new HashSet<>(Collections.singletonList(this.voteScope));
+ final Set<MessageScope> COUNT_SCOPE = new HashSet<>(Collections.singletonList(this.countScope));
return this.distributeVote && memory.isInitialIteration() ? COUNT_SCOPE : VOTE_SCOPE;
}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
index c55114e..62104c0 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/process/computer/bulkdumping/BulkDumperVertexProgramTest.java
@@ -48,7 +48,6 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest {
assertEquals(1, IteratorUtils.count(v.values("age", "lang")));
final String name = v.value("name");
if (name.equals("marko")) {
- assertEquals(1, v.id());
assertEquals("person", v.label());
assertEquals(Integer.valueOf(29), v.value("age"));
assertEquals(3, IteratorUtils.count(v.edges(Direction.OUT)));
@@ -56,21 +55,18 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest {
assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT, "created")));
assertEquals(0, IteratorUtils.count(v.edges(Direction.IN)));
} else if (name.equals("vadas")) {
- assertEquals(2, v.id());
assertEquals("person", v.label());
assertEquals(Integer.valueOf(27), v.value("age"));
assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows")));
} else if (name.equals("lop")) {
- assertEquals(3, v.id());
assertEquals("software", v.label());
assertEquals("java", v.value("lang"));
assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
assertEquals(3, IteratorUtils.count(v.edges(Direction.IN)));
assertEquals(3, IteratorUtils.count(v.edges(Direction.IN, "created")));
} else if (name.equals("josh")) {
- assertEquals(4, v.id());
assertEquals("person", v.label());
assertEquals(Integer.valueOf(32), v.value("age"));
assertEquals(2, IteratorUtils.count(v.edges(Direction.OUT)));
@@ -78,14 +74,12 @@ public class BulkDumperVertexProgramTest extends AbstractGremlinProcessTest {
assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "knows")));
} else if (name.equals("ripple")) {
- assertEquals(5, v.id());
assertEquals("software", v.label());
assertEquals("java", v.value("lang"));
assertEquals(0, IteratorUtils.count(v.edges(Direction.OUT)));
assertEquals(1, IteratorUtils.count(v.edges(Direction.IN)));
assertEquals(1, IteratorUtils.count(v.edges(Direction.IN, "created")));
} else if (name.equals("peter")) {
- assertEquals(6, v.id());
assertEquals("person", v.label());
assertEquals(Integer.valueOf(35), v.value("age"));
assertEquals(1, IteratorUtils.count(v.edges(Direction.OUT)));
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7aa9782c/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
----------------------------------------------------------------------
diff --git a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
index 2b953ab..4dbbc5f 100644
--- a/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
+++ b/gremlin-test/src/main/java/org/apache/tinkerpop/gremlin/structure/TransactionTest.java
@@ -648,7 +648,7 @@ public class TransactionTest extends AbstractGremlinTest {
} catch (Exception ex) {
assertThat(ex, instanceOf(IllegalStateException.class));
} finally {
- threadedG.tx().rollback();
+ if (threadedG.tx().isOpen()) threadedG.tx().rollback();
}
}
[09/10] tinkerpop git commit: updated CHANGELOG
Posted by ok...@apache.org.
updated CHANGELOG
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/1eac35b9
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/1eac35b9
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/1eac35b9
Branch: refs/heads/master
Commit: 1eac35b9b6b13860293292dd8a141a44fd3af7e0
Parents: d8eaf20 b0bedf6
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:19:21 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:19:21 2016 -0600
----------------------------------------------------------------------
CHANGELOG.asciidoc | 2 +
.../decoration/VertexProgramStrategy.java | 5 -
.../process/traversal/TraversalStrategies.java | 11 +-
.../process/TraversalStrategiesTest.java | 195 ++++++++++++++++++-
4 files changed, 202 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/1eac35b9/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index baf50a1,1c7441b..cf8c007
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -26,10 -26,7 +26,12 @@@ image::https://raw.githubusercontent.co
TinkerPop 3.2.4 (Release Date: NOT OFFICIALLY RELEASED YET)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
++* `SparkGraphComputer` no longer starts a worker iteration if the worker's partition is empty.
+* Added `ProjectStep.getProjectKeys()` for strategies that rely on such information.
+* Added `VertexFeatures.supportsDuplicateMultiProperties()` for graphs that only support unique values in multi-properties.
+* Deprecated the "performance" tests in `OptIn`.
+* Added `Pick.none` and `Pick.any` to the serializers and importers.
+ * Added a class loader to `TraversalStrategies.GlobalCache` which guarantees strategies are registered prior to `GlobalCache.getStrategies()`.
* Fixed a severe bug where `GraphComputer` strategies are not being loaded until the second use of the traversal source.
[[release-3-2-3]]
[08/10] tinkerpop git commit: Merge branch 'TINKERPOP-1525-tp32' of
https://github.com/dalaro/incubator-tinkerpop into tp32
Posted by ok...@apache.org.
Merge branch 'TINKERPOP-1525-tp32' of https://github.com/dalaro/incubator-tinkerpop into tp32
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d8eaf208
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d8eaf208
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d8eaf208
Branch: refs/heads/master
Commit: d8eaf20822952908037220b6659f9d801e873c73
Parents: 7c1ee36 36e1159
Author: Marko A. Rodriguez <ok...@gmail.com>
Authored: Sat Oct 29 15:17:11 2016 -0600
Committer: Marko A. Rodriguez <ok...@gmail.com>
Committed: Sat Oct 29 15:17:11 2016 -0600
----------------------------------------------------------------------
.../gremlin/spark/process/computer/SparkExecutor.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
[03/10] tinkerpop git commit: Avoid starting VP worker iterations
that never end
Posted by ok...@apache.org.
Avoid starting VP worker iterations that never end
SparkExecutor.executeVertexProgramIteration was written in such a way
that an empty RDD partition would cause it to invoke
VertexProgram.workerIterationStart without ever invoking
VertexProgram.workerIterationEnd. This seems like a contract
violation. I have at least one VP that relies on
workerIterationStart|End to allocate and release resources. Failing
to invoke End like this causes a leak in that VP, as it would for any
VP that uses that resource management pattern.
Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/36e1159a
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/36e1159a
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/36e1159a
Branch: refs/heads/master
Commit: 36e1159a80f539b8bd4a884e5c1cf304ec52c4f9
Parents: b262c7e
Author: Dan LaRocque <da...@hopcount.org>
Authored: Tue Oct 25 19:37:17 2016 -0500
Committer: Dan LaRocque <da...@hopcount.org>
Committed: Tue Oct 25 20:37:17 2016 -0400
----------------------------------------------------------------------
.../gremlin/spark/process/computer/SparkExecutor.java | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/36e1159a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
index 8dd2381..6e65e26 100644
--- a/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
+++ b/spark-gremlin/src/main/java/org/apache/tinkerpop/gremlin/spark/process/computer/SparkExecutor.java
@@ -91,9 +91,15 @@ public final class SparkExecutor {
// for each partition of vertices emit a view and their outgoing messages
.mapPartitionsToPair(partitionIterator -> {
KryoShimServiceLoader.applyConfiguration(graphComputerConfiguration);
+
+ // if the partition is empty, return without starting a new VP iteration
+ if (!partitionIterator.hasNext())
+ return Collections.emptyList();
+
final VertexProgram<M> workerVertexProgram = VertexProgram.createVertexProgram(HadoopGraph.open(graphComputerConfiguration), vertexProgramConfiguration); // each partition(Spark)/worker(TP3) has a local copy of the vertex program (a worker's task)
final String[] vertexComputeKeysArray = VertexProgramHelper.vertexComputeKeysAsArray(workerVertexProgram.getVertexComputeKeys()); // the compute keys as an array
final SparkMessenger<M> messenger = new SparkMessenger<>();
+
workerVertexProgram.workerIterationStart(memory.asImmutable()); // start the worker
return () -> IteratorUtils.map(partitionIterator, vertexViewIncoming -> {
final StarGraph.StarVertex vertex = vertexViewIncoming._2()._1().get(); // get the vertex from the vertex writable