tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dkupp...@apache.org
Subject [20/50] [abbrv] tinkerpop git commit: TINKERPOP-1778 Change documentation around usage of TimedInterruptCustomizerProvider
Date Thu, 21 Jun 2018 18:02:16 GMT
TINKERPOP-1778 Change documentation around usage of TimedInterruptCustomizerProvider

We really shouldn't promote this setting in Gremlin Server as it competes with the scriptEvaluationTimeout.

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

Branch: refs/heads/shortest-path-wip
Commit: 2495e8e0f27bd636744f81bfef477f10c19d3778
Parents: eba1df3
Author: Stephen Mallette <spmva@genoprime.com>
Authored: Mon Jun 18 09:20:38 2018 -0400
Committer: Stephen Mallette <spmva@genoprime.com>
Committed: Mon Jun 18 09:20:38 2018 -0400

 CHANGELOG.asciidoc                                |  3 ++-
 docs/src/reference/gremlin-applications.asciidoc  | 18 ++++++++++--------
 .../src/upgrade/release-3.2.x-incubating.asciidoc |  8 ++++++++
 .../jsr223/GroovyCompilerGremlinPlugin.java       |  7 +++++++
 4 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index a1d0963..ab776d0 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,7 +23,8 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 === TinkerPop 3.2.10 (Release Date: NOT OFFICIALLY RELEASED YET)
-* Added Docker images for Gremlin Console and Gremlin Server
+* Removed `ThreadInterruptCustomizerProvider` from documentation as a way to timeout
+* Added Docker images for Gremlin Console and Gremlin Server.
 * Fixed bug in `branch()` where reducing steps as options would produce incorrect results.
 * Removed recursive handling of streaming results from Gremlin-Python driver to avoid max
recursion depth errors.
 * Improved performance of `TraversalVertexProgram` and related infrastructure.

diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index f044df8..f967a9c 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -1143,7 +1143,7 @@ The following table describes the various configuration options that
Gremlin Ser
 |scriptEngines.<name>.staticImports |A comma separated list of "static" imports to
make available to the `ScriptEngine`. |_none_
 |scriptEngines.<name>.scripts |A comma separated list of script files to execute on
`ScriptEngine` initialization. `Graph` and `TraversalSource` instance references produced
from scripts will be stored globally in Gremlin Server, therefore it is possible to use initialization
scripts to add Traversal Strategies or create entirely new `Graph` instances all together.
Instantiating a `LifeCycleHook` in a script provides a way to execute scripts when Gremlin
Server starts and stops.|_none_
 |scriptEngines.<name>.config |A `Map` of configuration settings for the `ScriptEngine`.
 These settings are dependent on the `ScriptEngine` implementation being used. |_none_
-|scriptEvaluationTimeout |The amount of time in milliseconds before a script evaluation times
out. The notion of "script evaluation" refers to the time it takes for the `ScriptEngine`
to do its work and *not* any additional time it takes for the result of the evaluation to
be iterated and serialized. This feature can be turned off by setting the value to `0`. |30000
+|scriptEvaluationTimeout |The amount of time in milliseconds before a script evaluation and
iteration of result times out. This feature can be turned off by setting the value to `0`.
 |serializers |A `List` of `Map` settings, where each `Map` represents a `MessageSerializer`
implementation to use along with its configuration. If this value is not set, then Gremlin
Server will configure with GraphSON and Gryo but will not register any `ioRegistries` for
configured graphs. |_empty_
 |serializers[X].className |The full class name of the `MessageSerializer` implementation.
 |serializers[X].config |A `Map` containing `MessageSerializer` specific configurations. |_none_
@@ -1374,18 +1374,22 @@ scriptEngines: {
     scripts: [scripts/empty-sample.groovy],
     config: {
       compilerCustomizerProviders: {
-        "org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider":[10000]
+        "org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.ThreadInterruptCustomizerProvider":[]
 This configuration sets up the script engine with a `CompilerCustomizerProvider` implementation.
-`TimedInterruptCustomizerProvider` injects checks that ensure that loops (like `while`) can
only execute for `10000`
-milliseconds.  With this configuration in place, a remote execution as follows, now times
out rather than consuming
-the thread continuously:
+`ThreadInterruptCustomizerProvider` injects checks that ensure that loops (like `while`)
respect thread interruption
+requests. Note that the empty square brackets following the declaration of the `ThreadInterruptCustomizerProvider`
+are for parameters - this particular `CustomizerProvider` takes no arguments to enable it.
With this configuration in
+place and assuming the `scriptEvaluationTimeout` is set to `30000` milliseconds, consider
the following remote
 gremlin> :remote connect tinkerpop.server conf/remote.yaml
 ==>Configured localhost/
 gremlin> :> while(true) { }
-Execution timed out after 10000 units. Start time: Fri Jul 24 11:04:52 EDT 2015
+Script evaluation exceeded the configured 'scriptEvaluationTimeout' threshold of 30000 ms
or evaluation was otherwise cancelled directly for request [while(true) { }]
 There are a number of pre-packaged `CustomizerProvider` implementations:
@@ -1396,7 +1400,6 @@ There are a number of pre-packaged `CustomizerProvider` implementations:
 |`CompilationOptionsCustomizerProvider` |The amount of time a script is allowed to compile
before a warning message is sent to the logs.
 |`ConfigurationCustomizerProvider` |Allows configuration of the Groovy `CompilerConfiguration`
object by taking a `Map` of key/value pairs where the "key" is a property to set on the `CompilerConfiguration`.
 |`ThreadInterruptCustomizerProvider` |Injects checks for thread interruption, thus allowing
the thread to potentially respect calls to `Thread.interrupt()`
-|`TimedInterruptCustomizerProvider` |Injects checks into loops to interrupt them if they
exceed the configured timeout in milliseconds.
 |`TypeCheckedCustomizerProvider` |Similar to the above mentioned, `CompileStaticCustomizerProvider`,
the `TypeCheckedCustomizerProvider` injects `TypeChecked` annotations to incoming scripts.
 More information on the nature of this annotation can be found in the link:http://docs.groovy-lang.org/latest/html/documentation/#_the_code_typechecked_code_annotation[Groovy
Documentation].  It too takes a comma separated list of link:http://docs.groovy-lang.org/latest/html/documentation/#Typecheckingextensions-Workingwithextensions[type
checking extensions].
@@ -1411,7 +1414,6 @@ scriptEngines: {
     config: {
       compilerCustomizerProviders: {
-        "org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.TimedInterruptCustomizerProvider":[10000],

diff --git a/docs/src/upgrade/release-3.2.x-incubating.asciidoc b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
index 593c631..90dd568 100644
--- a/docs/src/upgrade/release-3.2.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.2.x-incubating.asciidoc
@@ -44,6 +44,14 @@ See: link:https://issues.apache.org/jira/browse/TINKERPOP-1897[TINKERPOP-1897],
Documentation - Gremlin Console],
Documentation - Gremlin Server],
+==== TimedInterruptCustomizerProvider
+In Gremlin Server, it is best not to use {{TimedInterruptCustomizerProvider}} because it
can compete with the
+{{scriptEvaluationTimeout}} setting and produce a different error path. Simply rely on {{scriptEvaluationTimeout}}
+as it covers both script evaluation time and result iteration time.
+See: link:https://issues.apache.org/jira/browse/TINKERPOP-1778[TINKERPOP-1778]
 ==== TinkerFactory.createGratefulDead()
 The Grateful Dead dataset has been with TinkerPop since the early days of 1.x. It has always
been available as a

diff --git a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
index 5680a4f..14757d8 100644
--- a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
+++ b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyCompilerGremlinPlugin.java
@@ -87,6 +87,13 @@ public class GroovyCompilerGremlinPlugin extends AbstractGremlinPlugin
             return this;
+        /**
+         * Introduces timed checks to loops and other portions of a script to provide an
interrupt for a long running
+         * script. This configuration should not be used in conjunction with the Gremlin
Server which has its own
+         * {@code scriptEvaluationTimeout} which performs a similar task but in a more complete
way specific to the
+         * server. Configuring both may lead to inconsistent timeout errors returning from
the server. This
+         * configuration should only be used if configuring a standalone instance fo the
{@link GremlinGroovyScriptEngine}.
+         */
         public Builder timedInterrupt(final long timeInMillis) {
             this.timeInMillis = timeInMillis;
             return this;

View raw message