You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/07/18 16:46:24 UTC

[1/4] tinkerpop git commit: Initialization scripts to gremlin server won't timeout

Repository: tinkerpop
Updated Branches:
  refs/heads/master 751b6f53e -> a9ee01eca


Initialization scripts to gremlin server won't timeout

Prior to this change the timeout for init scripts was the same as the the timeout configured for the server. Since init scripts might need to be long run (e.g. a long load script to init a graph into memory) it would force the user to make their timeout setting really high. A really high setting might be really bad though for basic request/response. Perhaps in the future it would be better to make this a configuration but for now this change should suffice. CTR


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

Branch: refs/heads/master
Commit: 7c72e51dc7a27204e150232e8bba3eaa4cd91d9e
Parents: 362e772
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jul 18 12:12:54 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jul 18 12:12:54 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  3 ++-
 .../gremlin/groovy/engine/GremlinExecutor.java  | 27 +++++++++-----------
 .../server/util/ServerGremlinExecutor.java      |  8 +++---
 3 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c72e51d/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 52d289b..573f681 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -28,7 +28,8 @@ TinkerPop 3.2.6 (Release Date: NOT OFFICIALLY RELEASED YET)
 
 This release also includes changes from <<release-3-1-8, 3.1.8>>.
 
-* Added Gremlin.Net as an early preview.
+* Initialization scripts for Gremlin Server will not timeout.
+* Added Gremlin.Net.
 * `ProfileTest` is now less stringent about assertions which will reduce burdens on providers.
 * `GremlinExecutor` begins timeout of script evaluation at the time the script was submitted and not from the time it began evaluation.
 * `ReferenceFactory` and `DetachedFactory` now detach elements in collections accordingly.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c72e51d/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index da495e6..962f798 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -278,7 +278,7 @@ public class GremlinExecutor implements AutoCloseable {
         // override the timeout if the lifecycle has a value assigned
         final long scriptEvalTimeOut = lifeCycle.getScriptEvaluationTimeoutOverride().orElse(scriptEvaluationTimeout);
 
-        final WeakReference<CompletableFuture<Object>> evaluationFuture = new WeakReference<>(new CompletableFuture<>());
+        final CompletableFuture<Object> evaluationFuture = new CompletableFuture<>();
         final FutureTask<Void> evalFuture = new FutureTask<>(() -> {
             try {
                 lifeCycle.getBeforeEval().orElse(beforeEval).accept(bindings);
@@ -306,36 +306,33 @@ public class GremlinExecutor implements AutoCloseable {
                 // that must raise as an exception to the caller who has the returned evaluationFuture. in other words,
                 // if it occurs before this point, then the handle() method won't be called again if there is an
                 // exception that ends up below trying to completeExceptionally()
-                final CompletableFuture<Object> ef = evaluationFuture.get();
-                if (ef != null) ef.complete(result);
+                evaluationFuture.complete(result);
             } catch (Throwable ex) {
                 final Throwable root = null == ex.getCause() ? ex : ExceptionUtils.getRootCause(ex);
 
                 // thread interruptions will typically come as the result of a timeout, so in those cases,
                 // check for that situation and convert to TimeoutException
-                final CompletableFuture<Object> ef = evaluationFuture.get();
-                if (ef != null) {
-                    if (root instanceof InterruptedException) {
-                        lifeCycle.getAfterTimeout().orElse(afterTimeout).accept(bindings);
-                        ef.completeExceptionally(new TimeoutException(
-                                String.format("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of %s ms or evaluation was otherwise cancelled directly for request [%s]: %s", scriptEvalTimeOut, script, root.getMessage())));
-                    } else {
-                        lifeCycle.getAfterFailure().orElse(afterFailure).accept(bindings, root);
-                        ef.completeExceptionally(root);
-                    }
+                if (root instanceof InterruptedException) {
+                    lifeCycle.getAfterTimeout().orElse(afterTimeout).accept(bindings);
+                    evaluationFuture.completeExceptionally(new TimeoutException(
+                            String.format("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of %s ms or evaluation was otherwise cancelled directly for request [%s]: %s", scriptEvalTimeOut, script, root.getMessage())));
+                } else {
+                    lifeCycle.getAfterFailure().orElse(afterFailure).accept(bindings, root);
+                    evaluationFuture.completeExceptionally(root);
                 }
             }
 
             return null;
         });
 
+        final WeakReference<CompletableFuture<Object>> evaluationFutureRef = new WeakReference<>(evaluationFuture);
         final Future<?> executionFuture = executorService.submit(evalFuture);
         if (scriptEvalTimeOut > 0) {
             // Schedule a timeout in the thread pool for future execution
             scheduledExecutorService.schedule(() -> {
                 if (executionFuture.cancel(true)) {
                     lifeCycle.getAfterTimeout().orElse(afterTimeout).accept(bindings);
-                    final CompletableFuture<Object> ef = evaluationFuture.get();
+                    final CompletableFuture<Object> ef = evaluationFutureRef.get();
                     if (ef != null) {
                         ef.completeExceptionally(new TimeoutException(
                                 String.format("Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of %s ms or evaluation was otherwise cancelled directly for request [%s]", scriptEvalTimeOut, script)));
@@ -344,7 +341,7 @@ public class GremlinExecutor implements AutoCloseable {
             }, scriptEvalTimeOut, TimeUnit.MILLISECONDS);
         }
 
-        return evaluationFuture.get();
+        return evaluationFuture;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/7c72e51d/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index 8398dbb..b878549 100644
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@ -18,10 +18,8 @@
  */
 package org.apache.tinkerpop.gremlin.server.util;
 
-import com.codahale.metrics.Gauge;
 import org.apache.tinkerpop.gremlin.groovy.engine.GremlinExecutor;
 import org.apache.tinkerpop.gremlin.groovy.engine.ScriptEngines;
-import org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngine;
 import org.apache.tinkerpop.gremlin.jsr223.GremlinScriptEngine;
 import org.apache.tinkerpop.gremlin.process.traversal.TraversalSource;
 import org.apache.tinkerpop.gremlin.server.Channelizer;
@@ -32,6 +30,7 @@ import org.apache.tinkerpop.gremlin.structure.Graph;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.script.SimpleBindings;
 import java.lang.reflect.Constructor;
 import java.util.Collections;
 import java.util.HashSet;
@@ -177,7 +176,10 @@ public class ServerGremlinExecutor<T extends ScheduledExecutorService> {
         // runs the init scripts when the GremlinScriptEngine is created.
         settings.scriptEngines.keySet().forEach(engineName -> {
             try {
-                gremlinExecutor.eval("1+1", engineName, Collections.emptyMap()).join();
+                // use no timeout on the engine initialization - perhaps this can be a configuration later
+                final GremlinExecutor.LifeCycle lifeCycle = GremlinExecutor.LifeCycle.build().
+                        scriptEvaluationTimeoutOverride(0L).create();
+                gremlinExecutor.eval("1+1", engineName, new SimpleBindings(Collections.emptyMap()), lifeCycle).join();
                 registerMetrics(engineName);
                 logger.info("Initialized {} GremlinScriptEngine and registered metrics", engineName);
             } catch (Exception ex) {


[2/4] tinkerpop git commit: Merge branch 'tp32'

Posted by sp...@apache.org.
Merge branch 'tp32'

Conflicts:
	CHANGELOG.asciidoc
	gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java


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

Branch: refs/heads/master
Commit: a7ee024d6e6a3c1ecdada2ac78c341b0340da08a
Parents: 751b6f5 7c72e51
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jul 18 12:45:04 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jul 18 12:45:04 2017 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  2 ++
 .../gremlin/groovy/engine/GremlinExecutor.java  | 27 +++++++++-----------
 .../server/util/ServerGremlinExecutor.java      |  6 ++++-
 3 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a7ee024d/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --cc CHANGELOG.asciidoc
index 3085a2e,573f681..47668bb
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@@ -137,9 -28,10 +137,11 @@@ TinkerPop 3.2.6 (Release Date: NOT OFFI
  
  This release also includes changes from <<release-3-1-8, 3.1.8>>.
  
+ * Initialization scripts for Gremlin Server will not timeout.
+ * Added Gremlin.Net.
  * `ProfileTest` is now less stringent about assertions which will reduce burdens on providers.
  * `GremlinExecutor` begins timeout of script evaluation at the time the script was submitted and not from the time it began evaluation.
 +* Added Gremlin.Net.
  * `ReferenceFactory` and `DetachedFactory` now detach elements in collections accordingly.
  * Deprecated `GryoLiteMessageSerializerV1d0` in favor of `HaltedTraverserStrategy`.
  * Deprecated the `useMapperFromGraph` configuration option for Gremlin Server serializers.

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a7ee024d/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a7ee024d/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
----------------------------------------------------------------------
diff --cc gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
index 9bd58a0,b878549..e95b61a
--- a/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
+++ b/gremlin-server/src/main/java/org/apache/tinkerpop/gremlin/server/util/ServerGremlinExecutor.java
@@@ -29,8 -30,10 +29,9 @@@ import org.apache.tinkerpop.gremlin.str
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
+ import javax.script.SimpleBindings;
  import java.lang.reflect.Constructor;
  import java.util.Collections;
 -import java.util.HashSet;
  import java.util.List;
  import java.util.Map;
  import java.util.concurrent.ConcurrentHashMap;


[4/4] tinkerpop git commit: Drops the deprecated group step from gremlin .net CTR

Posted by sp...@apache.org.
Drops the deprecated group step from gremlin .net CTR


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

Branch: refs/heads/master
Commit: a9ee01eca16e6d45100cc5cde584a3325fbbc240
Parents: d0a7323
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jul 18 12:45:57 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jul 18 12:45:57 2017 -0400

----------------------------------------------------------------------
 .../src/Gremlin.Net/Process/Traversal/GraphTraversal.cs     | 9 ---------
 gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs      | 8 --------
 2 files changed, 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a9ee01ec/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
index 329941d..713e002 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/GraphTraversal.cs
@@ -315,15 +315,6 @@ namespace Gremlin.Net.Process.Traversal
         }
 
         /// <summary>
-        ///     Adds the groupV3d0 step to this <see cref="GraphTraversal{SType, EType}" />.
-        /// </summary>
-        public GraphTraversal< S , E > GroupV3d0 (params object[] args)
-        {
-            Bytecode.AddStep("groupV3d0", args);
-            return Wrap< S , E >(this);
-        }
-
-        /// <summary>
         ///     Adds the has step to this <see cref="GraphTraversal{SType, EType}" />.
         /// </summary>
         public GraphTraversal< S , E > Has (params object[] args)

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a9ee01ec/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
----------------------------------------------------------------------
diff --git a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
index cf40c11..d44d62c 100644
--- a/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
+++ b/gremlin-dotnet/src/Gremlin.Net/Process/Traversal/__.cs
@@ -249,14 +249,6 @@ namespace Gremlin.Net.Process.Traversal
         }
 
         /// <summary>
-        ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the groupV3d0 step to that traversal.
-        /// </summary>
-        public static GraphTraversal<object, object> GroupV3d0(params object[] args)
-        {
-            return new GraphTraversal<object, object>().GroupV3d0(args);
-        }
-
-        /// <summary>
         ///     Spawns a <see cref="GraphTraversal{SType, EType}" /> and adds the has step to that traversal.
         /// </summary>
         public static GraphTraversal<object, object> Has(params object[] args)


[3/4] tinkerpop git commit: This should have been part of the last merge commit CTR

Posted by sp...@apache.org.
This should have been part of the last merge commit CTR


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

Branch: refs/heads/master
Commit: d0a73235491c0a4fea696940eb0f600fcf2ab6e6
Parents: a7ee024
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Jul 18 12:45:16 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Jul 18 12:45:16 2017 -0400

----------------------------------------------------------------------
 .../apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java   | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d0a73235/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
----------------------------------------------------------------------
diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
index beab8a4..f702dee 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutor.java
@@ -35,9 +35,6 @@ import javax.script.Compilable;
 import javax.script.CompiledScript;
 import javax.script.ScriptException;
 import javax.script.SimpleBindings;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
 import java.lang.ref.WeakReference;
 import java.lang.reflect.Method;
 import java.util.Collection;