tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ok...@apache.org
Subject tinkerpop git commit: doing the withComputer() fix in Gremlin-Python a little differently. Its more generic and doesn't tie Gremlin-Python to the Java implementation of the Gremlin traversal machine. CTR.
Date Wed, 12 Oct 2016 23:05:31 GMT
Repository: tinkerpop
Updated Branches:
  refs/heads/master e56e97d5d -> 227b85cb3


doing the withComputer() fix in Gremlin-Python a little differently. Its more generic and
doesn't tie Gremlin-Python to the Java implementation of the Gremlin traversal machine. CTR.


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/227b85cb
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/227b85cb
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/227b85cb

Branch: refs/heads/master
Commit: 227b85cb3e793c3d5cd561cdf3965a22775bb98a
Parents: e56e97d
Author: Marko A. Rodriguez <okrammarko@gmail.com>
Authored: Wed Oct 12 17:05:26 2016 -0600
Committer: Marko A. Rodriguez <okrammarko@gmail.com>
Committed: Wed Oct 12 17:05:26 2016 -0600

----------------------------------------------------------------------
 .../strategy/decoration/VertexProgramStrategy.java        | 10 ++++++----
 .../src/main/jython/gremlin_python/process/strategies.py  |  8 ++++----
 2 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/227b85cb/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 21c1ae6..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
@@ -55,6 +55,8 @@ import java.util.Set;
  */
 public final class VertexProgramStrategy extends AbstractTraversalStrategy<TraversalStrategy.DecorationStrategy>
implements TraversalStrategy.DecorationStrategy {
 
+    private static final VertexProgramStrategy INSTANCE = new VertexProgramStrategy(Computer.compute());
+
     private final Computer computer;
 
     private VertexProgramStrategy() {
@@ -65,10 +67,6 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
         this.computer = computer;
     }
 
-    public Computer getComputer() {
-        return this.computer;
-    }
-
     @Override
     public void apply(final Traversal.Admin<?, ?> traversal) {
         // VertexPrograms can only execute at the root level of a Traversal and should not
be applied locally prior to RemoteStrategy
@@ -177,6 +175,10 @@ public final class VertexProgramStrategy extends AbstractTraversalStrategy<Trave
         traversalSource.getStrategies().addStrategies(graphComputerStrategies.toArray(new
TraversalStrategy[graphComputerStrategies.size()]));
     }
 
+    public static VertexProgramStrategy instance() {
+        return INSTANCE;
+    }
+
     ////////////////////////////////////////////////////////////
 
     public static final String GRAPH_COMPUTER = "graphComputer";

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/227b85cb/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
----------------------------------------------------------------------
diff --git a/gremlin-python/src/main/jython/gremlin_python/process/strategies.py b/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
index b5ea065..4d4cbda 100644
--- a/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
+++ b/gremlin-python/src/main/jython/gremlin_python/process/strategies.py
@@ -70,11 +70,11 @@ class SubgraphStrategy(TraversalStrategy):
 
 
 class VertexProgramStrategy(TraversalStrategy):
-    def __init__(self, graph_computer=None,
-                 workers=None, persist=None, result=None, vertices=None, edges=None, configuration=None):
+    def __init__(self, graph_computer=None, workers=None, persist=None, result=None, vertices=None,
edges=None,
+                 configuration=None):
         TraversalStrategy.__init__(self)
-        self.configuration["graphComputer"] = \
-            graph_computer if graph_computer is not None else "org.apache.tinkerpop.gremlin.process.computer.GraphComputer"
+        if graph_computer is not None:
+            self.configuration["graphComputer"] = graph_computer
         if workers is not None:
             self.configuration["workers"] = workers
         if persist is not None:


Mime
View raw message