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 2016/05/02 13:00:08 UTC

[1/4] incubator-tinkerpop git commit: Removed a note about deprecation in dev docs that didn't make sense. [Forced Update!]

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/TINKERPOP-1267 c79cbcd77 -> 2284ea90b (forced update)


Removed a note about deprecation in dev docs that didn't make sense.

Deprecation work need not be tied to a JIRA ticket with a "breaking" label. If we deprecated properly, there should be no breaking change and hence no need for the label.  CTR


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

Branch: refs/heads/TINKERPOP-1267
Commit: f23def3afbd658024a8d08294048beb4566c4800
Parents: 606b59a
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 26 07:43:24 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Tue Apr 26 07:43:24 2016 -0400

----------------------------------------------------------------------
 docs/src/dev/developer/contributing.asciidoc | 3 ---
 1 file changed, 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/f23def3a/docs/src/dev/developer/contributing.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/contributing.asciidoc b/docs/src/dev/developer/contributing.asciidoc
index b33aeb9..ffc8156 100644
--- a/docs/src/dev/developer/contributing.asciidoc
+++ b/docs/src/dev/developer/contributing.asciidoc
@@ -270,9 +270,6 @@ replaced then the comment can simply read "not replaced".  Additional comments t
 encouraged.
 ** `@see <a href="https://issues.apache.org/jira/browse/TINKERPOP-XXX">TINKERPOP-XXX</a>` - supply a link to the
 JIRA issue for reference.
-* All deprecation should typically be tied to a JIRA issue with a "breaking" label - the issue itself does not need to
-specifically or solely be about "deprecation" but it should be documented very clearly in the comments what was
-deprecated and what the path forward should be.
 * Be sure that deprecated methods are still under test - consider using javadoc/comments in the tests themselves to
 call out this fact.
 * Create a new JIRA issue to track removal of the deprecation for future evaluation - this issue should have the


[4/4] incubator-tinkerpop git commit: Added option for "none" on remote timeouts.

Posted by sp...@apache.org.
Added option for "none" on remote timeouts.


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

Branch: refs/heads/TINKERPOP-1267
Commit: 2284ea90b5f3c93c2d0699cce67f7e481382d8d3
Parents: 14966d7
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Tue Apr 26 07:35:23 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon May 2 06:59:59 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 .../src/reference/gremlin-applications.asciidoc |  4 +--
 .../upgrade/release-3.1.x-incubating.asciidoc   | 25 ++++++++++++++++
 .../groovy/plugin/DriverRemoteAcceptor.java     | 30 ++++++++++++++------
 .../groovy/plugin/DriverRemoteAcceptorTest.java | 18 ++++++++++++
 5 files changed, 68 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2284ea90/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 5600245..1848fdf 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.1.3 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added configuration option for disabling `:remote` timeout with `:remote config timeout none`.
 * Added `init-tp-spark.sh` to Gremlin Console binary distribution.
 * Fixed bug where use of `:x` in a Gremlin Console initialization script would generate a stack trace.
 * Added configuration options to Gremlin Driver and Server to override the SSL configuration with an `SslContext`.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2284ea90/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 410dfe1..a894335 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -467,8 +467,8 @@ The Gremlin Server `:remote config` command for the driver has the following con
 !`reset` !Clears any aliases that were supplied in previous configurations of the remote.
 !`show` !Shows the current set of aliases which is returned as a `Map`
 !=========================================================
-|timeout |Specifies the length of time in milliseconds a will wait for a response from the server. Specify "max" to
-essentially have no timeout.
+|timeout |Specifies the length of time in milliseconds a will wait for a response from the server. Specify "none" to
+have no timeout. By default, this setting uses "none".
 |=========================================================
 
 [[console-aliases]]

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2284ea90/docs/src/upgrade/release-3.1.x-incubating.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/upgrade/release-3.1.x-incubating.asciidoc b/docs/src/upgrade/release-3.1.x-incubating.asciidoc
index 070cc52..4de6dbd 100644
--- a/docs/src/upgrade/release-3.1.x-incubating.asciidoc
+++ b/docs/src/upgrade/release-3.1.x-incubating.asciidoc
@@ -29,6 +29,31 @@ TinkerPop 3.1.3
 
 Please see the link:https://github.com/apache/incubator-tinkerpop/blob/3.1.2-incubating/CHANGELOG.asciidoc#tinkerpop-313-release-date-MONTH-DAY-YEAR[changelog] for a complete list of all the modifications that are part of this release.
 
+Upgrading for Users
+~~~~~~~~~~~~~~~~~~~
+
+Remote Timeout
+^^^^^^^^^^^^^^
+
+Disabling the timeout for a `:remote` to Gremlin Server was previously accomplished by setting the timeout to `max` as
+in:
+
+[source,text]
+:remote config timeout max
+
+where `max` would set the timeout to be `Integer.MAX_VALUE`. While this feature is still supported, it has been
+deprecated in favor of the new configuration option of `none`, as in:
+
+[source,text]
+:remote config timeout none
+
+The use of `none` completely disables the timeout rather than just setting an arbitrarily high one. Note that it is
+still possible to get a timeout on a request if the server timeout limits are reached. The console timeout value only
+refers to how long the console will wait for a response from the server before giving up. By default, the timeout is
+set to `none`.
+
+See: https://issues.apache.org/jira/browse/TINKERPOP-1267[TINKERPOP-1267]
+
 Upgrading for Providers
 ~~~~~~~~~~~~~~~~~~~~~~~
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2284ea90/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
index c92d5b3..ed98011 100644
--- a/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
+++ b/gremlin-console/src/main/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptor.java
@@ -21,6 +21,7 @@ package org.apache.tinkerpop.gremlin.console.groovy.plugin;
 import org.apache.tinkerpop.gremlin.driver.Client;
 import org.apache.tinkerpop.gremlin.driver.Cluster;
 import org.apache.tinkerpop.gremlin.driver.Result;
+import org.apache.tinkerpop.gremlin.driver.ResultSet;
 import org.apache.tinkerpop.gremlin.driver.exception.ResponseException;
 import org.apache.tinkerpop.gremlin.driver.message.ResponseStatusCode;
 import org.apache.tinkerpop.gremlin.groovy.plugin.RemoteAcceptor;
@@ -52,15 +53,23 @@ import java.util.stream.Stream;
  * @author Marko A. Rodriguez (http://markorodriguez.com)
  */
 public class DriverRemoteAcceptor implements RemoteAcceptor {
+    public static final int NO_TIMEOUT = -1;
+
     private Cluster currentCluster;
     private Client currentClient;
-    private int timeout = 180000;
+    private int timeout = NO_TIMEOUT;
     private Map<String,String> aliases = new HashMap<>();
     private Optional<String> session = Optional.empty();
 
     private static final String TOKEN_RESET = "reset";
     private static final String TOKEN_SHOW = "show";
+
+    /**
+     * @deprecated As of 3.1.3-incubating, replaced by "none" option
+     */
+    @Deprecated
     private static final String TOKEN_MAX = "max";
+    private static final String TOKEN_NONE = "none";
     private static final String TOKEN_TIMEOUT = "timeout";
     private static final String TOKEN_ALIAS = "alias";
     private static final String TOKEN_SESSION = "session";
@@ -104,13 +113,14 @@ public class DriverRemoteAcceptor implements RemoteAcceptor {
         final List<String> arguments = args.subList(1, args.size());
 
         if (option.equals(TOKEN_TIMEOUT)) {
-            final String errorMessage = "The timeout option expects a positive integer representing milliseconds or 'max' as an argument";
+            final String errorMessage = "The timeout option expects a positive integer representing milliseconds or 'none' as an argument";
             if (arguments.size() != 1) throw new RemoteException(errorMessage);
             try {
-                final int to = arguments.get(0).equals(TOKEN_MAX) ? Integer.MAX_VALUE : Integer.parseInt(arguments.get(0));
-                if (to <= 0) throw new RemoteException(errorMessage);
-                this.timeout = to;
-                return "Set remote timeout to " + to + "ms";
+                // first check for MAX timeout then NONE and finally parse the config to int. "max" is now "deprecated"
+                // in the sense that it will no longer be promoted. support for it will be removed at a later date
+                timeout = arguments.get(0).equals(TOKEN_MAX) ? Integer.MAX_VALUE :
+                        arguments.get(0).equals(TOKEN_NONE) ? NO_TIMEOUT : Integer.parseInt(arguments.get(0));
+                return timeout == NO_TIMEOUT ? "Remote timeout is disable" : "Set remote timeout to " + timeout + "ms";
             } catch (Exception ignored) {
                 throw new RemoteException(errorMessage);
             }
@@ -171,10 +181,14 @@ public class DriverRemoteAcceptor implements RemoteAcceptor {
         if (this.currentCluster != null) this.currentCluster.close();
     }
 
+    public int getTimeout() {
+        return timeout;
+    }
+
     private List<Result> send(final String gremlin) throws SaslException {
         try {
-            return this.currentClient.submitAsync(gremlin, aliases, Collections.emptyMap()).get()
-                    .all().get(this.timeout, TimeUnit.MILLISECONDS);
+            final ResultSet rs = this.currentClient.submitAsync(gremlin, aliases, Collections.emptyMap()).get();
+            return timeout > 0 ? rs.all().get(timeout, TimeUnit.MILLISECONDS) : rs.all().get();
         } catch(TimeoutException ignored) {
             throw new IllegalStateException("Request timed out while processing - increase the timeout with the :remote command");
         } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/2284ea90/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
----------------------------------------------------------------------
diff --git a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
index d341098..987a932 100644
--- a/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
+++ b/gremlin-console/src/test/java/org/apache/tinkerpop/gremlin/console/groovy/plugin/DriverRemoteAcceptorTest.java
@@ -109,6 +109,24 @@ public class DriverRemoteAcceptorTest {
     }
 
     @Test
+    public void shouldConfigureTimeoutToMax() throws Exception {
+        acceptor.configure(Arrays.asList("timeout", "max"));
+        assertEquals(Integer.MAX_VALUE, acceptor.getTimeout());
+    }
+
+    @Test
+    public void shouldConfigureTimeoutToNone() throws Exception {
+        acceptor.configure(Arrays.asList("timeout", "none"));
+        assertEquals(DriverRemoteAcceptor.NO_TIMEOUT, acceptor.getTimeout());
+    }
+
+    @Test
+    public void shouldConfigureTimeout() throws Exception {
+        acceptor.configure(Arrays.asList("timeout", "123456"));
+        assertEquals(123456, acceptor.getTimeout());
+    }
+
+    @Test
     public void shouldConnect() throws Exception {
         // there is no gremlin server running for this test, but gremlin-driver lazily connects so this should
         // be ok to just validate that a connection is created


[2/4] incubator-tinkerpop git commit: Prevented error on use of :x in gremlin console init script.

Posted by sp...@apache.org.
Prevented error on use of :x in gremlin console init script.

A simple fix - the init script execution just needed to occur inside an existing try/catch block where normal script execution occurred. CTR


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

Branch: refs/heads/TINKERPOP-1267
Commit: 5f9d2f9140fe32ce090ba774a09c7fb49dc74ac5
Parents: f23def3
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 27 07:56:16 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 27 07:56:16 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                                               | 1 +
 .../groovy/org/apache/tinkerpop/gremlin/console/Console.groovy   | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5f9d2f91/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index d6ef48b..422eb47 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.1.3 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Fixed bug where use of `:x` in a Gremlin Console initialization script would generate a stack trace.
 * Added configuration options to Gremlin Driver and Server to override the SSL configuration with an `SslContext`.
 * Added driver configuration settings for SSL: `keyCertChainFile`, `keyFile` and `keyPassword`.
 * Fixed bug where transaction managed sessions were not properly rolling back transactions for exceptions encountered during script evaluation.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/5f9d2f91/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
index 66b8b0e..a13e785 100644
--- a/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
+++ b/gremlin-console/src/main/groovy/org/apache/tinkerpop/gremlin/console/Console.groovy
@@ -139,9 +139,11 @@ class Console {
 
         // start iterating results to show as output
         showShellEvaluationOutput(true)
-        if (initScriptFile != null) initializeShellWithScript(initScriptFile)
 
         try {
+            // if the init script contains :x command it will throw an ExitNotification so init script execution
+            // needs to appear in the try/catch
+            if (initScriptFile != null) initializeShellWithScript(initScriptFile)
             runner.run()
         } catch (ExitNotification ignored) {
             // occurs on exit


[3/4] incubator-tinkerpop git commit: Added init-tp-spark.sh to console distribution.

Posted by sp...@apache.org.
Added init-tp-spark.sh to console distribution.

This shell script was referenced in the docs but was not contained in the console zip. Moved the source location of the script to spark-gremlin as that seemed consistent with how things were being done for external configuration files (i.e. hadoop-gremlin config stuff).


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

Branch: refs/heads/TINKERPOP-1267
Commit: 14966d789e859db709f5a6426f88c6722ebe1a2b
Parents: 5f9d2f9
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Apr 27 08:13:47 2016 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Apr 27 08:17:51 2016 -0400

----------------------------------------------------------------------
 CHANGELOG.asciidoc                              |  1 +
 bin/init-tp-spark.sh                            | 75 --------------------
 .../reference/implementations-hadoop.asciidoc   |  2 +-
 gremlin-console/src/assembly/distribution.xml   |  9 +++
 gremlin-console/src/assembly/standalone.xml     |  5 ++
 spark-gremlin/src/main/bin/init-tp-spark.sh     | 75 ++++++++++++++++++++
 6 files changed, 91 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14966d78/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 422eb47..5600245 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -26,6 +26,7 @@ image::https://raw.githubusercontent.com/apache/incubator-tinkerpop/master/docs/
 TinkerPop 3.1.3 (NOT OFFICIALLY RELEASED YET)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+* Added `init-tp-spark.sh` to Gremlin Console binary distribution.
 * Fixed bug where use of `:x` in a Gremlin Console initialization script would generate a stack trace.
 * Added configuration options to Gremlin Driver and Server to override the SSL configuration with an `SslContext`.
 * Added driver configuration settings for SSL: `keyCertChainFile`, `keyFile` and `keyPassword`.

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14966d78/bin/init-tp-spark.sh
----------------------------------------------------------------------
diff --git a/bin/init-tp-spark.sh b/bin/init-tp-spark.sh
deleted file mode 100755
index 51eca6b..0000000
--- a/bin/init-tp-spark.sh
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/bin/bash
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#   http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-
-if [ -z $2 ]; then
-  echo
-  echo "Usage:"
-  echo
-  echo "  $0 SPARK_HOME SPARK_NODE_1 SPARK_NODE_2 ..."
-  echo
-  echo "Example:"
-  echo
-  echo "  $0 /usr/local/spark-1.5.2-bin-hadoop2.6 spark@master spark@slave1 spark@slave2 spark@slave3"
-  echo
-  exit 1
-fi
-
-if [ -z ${HADOOP_GREMLIN_LIBS} ]; then
-  echo
-  echo "HADOOP_GREMLIN_LIBS is not set; thus no jars to deploy."
-  echo
-  exit 1
-fi
-
-LOCAL_SPARK_GREMLIN_LIBS=$(tr ':' $'\n' <<< ${HADOOP_GREMLIN_LIBS} | grep 'spark-gremlin')
-LIB_DIRNAME="hadoop-gremlin-libs"
-TMP_DIR=/tmp/init-tp-spark
-TMP_DIR2=${TMP_DIR}/${LIB_DIRNAME}
-
-mkdir -p ${TMP_DIR2}
-cp -R ${LOCAL_SPARK_GREMLIN_LIBS}/*.jar ${TMP_DIR2}
-
-DIR=`dirname $0`
-
-SPARK_HOME=${1}
-SPARK_LIBS=${SPARK_HOME}/lib
-SPARK_NODES=${@:2}
-
-cat > ${TMP_DIR}/init-conf.sh <<EOF
-#!/bin/bash
-
-if [ ! -f "${SPARK_HOME}/conf/spark-env.sh" ]; then
-  cp ${SPARK_HOME}/conf/spark-env.sh.template ${SPARK_HOME}/conf/spark-env.sh
-fi
-grep -F GREMLIN_LIBS ${SPARK_HOME}/conf/spark-env.sh > /dev/null || {
-  echo >> ${SPARK_HOME}/conf/spark-env.sh
-  echo "GREMLIN_LIBS=\\\$(find ${SPARK_LIBS}/${LIB_DIRNAME} -name '*.jar' | paste -sd ':')" >> ${SPARK_HOME}/conf/spark-env.sh
-  echo "export SPARK_CLASSPATH=\\\${SPARK_CLASSPATH}:\\\${GREMLIN_LIBS}" >> ${SPARK_HOME}/conf/spark-env.sh
-}
-EOF
-
-for node in ${SPARK_NODES}
-do
-  rsync -az --delete ${TMP_DIR2} ${node}:${SPARK_LIBS}
-  ssh ${node} "bash -s" -- < ${TMP_DIR}/init-conf.sh
-done
-
-rm -rf ${TMP_DIR}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14966d78/docs/src/reference/implementations-hadoop.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/implementations-hadoop.asciidoc b/docs/src/reference/implementations-hadoop.asciidoc
index 41b003d..8c591e2 100644
--- a/docs/src/reference/implementations-hadoop.asciidoc
+++ b/docs/src/reference/implementations-hadoop.asciidoc
@@ -283,7 +283,7 @@ Furthermore the `lib/` directory should be distributed across all machines in th
 provides a helper script, which takes the Spark installation directory and the the Spark machines as input:
 
 [source,shell]
-bin/init-tp-spark.sh /usr/local/spark spark@10.0.0.1 spark@10.0.0.2 spark@10.0.0.3
+bin/hadoop/init-tp-spark.sh /usr/local/spark spark@10.0.0.1 spark@10.0.0.2 spark@10.0.0.3
 
 Once the `lib/` directory is distributed, `SparkGraphComputer` can be used as follows.
 

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14966d78/gremlin-console/src/assembly/distribution.xml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/assembly/distribution.xml b/gremlin-console/src/assembly/distribution.xml
index bb3e77d..ab161fb 100644
--- a/gremlin-console/src/assembly/distribution.xml
+++ b/gremlin-console/src/assembly/distribution.xml
@@ -30,6 +30,15 @@ limitations under the License.
             </includes>
         </fileSet>
         <fileSet>
+            <fileMode>0775</fileMode>
+            <directory>target/apache-${project.artifactId}-${project.version}-standalone/bin/hadoop</directory>
+            <outputDirectory>bin/hadoop</outputDirectory>
+            <includes>
+                <include>*.sh</include>
+                <include>*.bat</include>
+            </includes>
+        </fileSet>
+        <fileSet>
             <directory>src/main/static/licenses</directory>
             <outputDirectory>licenses</outputDirectory>
         </fileSet>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14966d78/gremlin-console/src/assembly/standalone.xml
----------------------------------------------------------------------
diff --git a/gremlin-console/src/assembly/standalone.xml b/gremlin-console/src/assembly/standalone.xml
index ca27a51..e4115d5 100644
--- a/gremlin-console/src/assembly/standalone.xml
+++ b/gremlin-console/src/assembly/standalone.xml
@@ -28,6 +28,11 @@ limitations under the License.
             <fileMode>0755</fileMode>
         </fileSet>
         <fileSet>
+            <directory>../spark-gremlin/src/main/bin</directory>
+            <outputDirectory>/bin/hadoop</outputDirectory>
+            <fileMode>0755</fileMode>
+        </fileSet>
+        <fileSet>
             <directory>conf</directory>
             <outputDirectory>/conf</outputDirectory>
         </fileSet>

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/14966d78/spark-gremlin/src/main/bin/init-tp-spark.sh
----------------------------------------------------------------------
diff --git a/spark-gremlin/src/main/bin/init-tp-spark.sh b/spark-gremlin/src/main/bin/init-tp-spark.sh
new file mode 100755
index 0000000..51eca6b
--- /dev/null
+++ b/spark-gremlin/src/main/bin/init-tp-spark.sh
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+if [ -z $2 ]; then
+  echo
+  echo "Usage:"
+  echo
+  echo "  $0 SPARK_HOME SPARK_NODE_1 SPARK_NODE_2 ..."
+  echo
+  echo "Example:"
+  echo
+  echo "  $0 /usr/local/spark-1.5.2-bin-hadoop2.6 spark@master spark@slave1 spark@slave2 spark@slave3"
+  echo
+  exit 1
+fi
+
+if [ -z ${HADOOP_GREMLIN_LIBS} ]; then
+  echo
+  echo "HADOOP_GREMLIN_LIBS is not set; thus no jars to deploy."
+  echo
+  exit 1
+fi
+
+LOCAL_SPARK_GREMLIN_LIBS=$(tr ':' $'\n' <<< ${HADOOP_GREMLIN_LIBS} | grep 'spark-gremlin')
+LIB_DIRNAME="hadoop-gremlin-libs"
+TMP_DIR=/tmp/init-tp-spark
+TMP_DIR2=${TMP_DIR}/${LIB_DIRNAME}
+
+mkdir -p ${TMP_DIR2}
+cp -R ${LOCAL_SPARK_GREMLIN_LIBS}/*.jar ${TMP_DIR2}
+
+DIR=`dirname $0`
+
+SPARK_HOME=${1}
+SPARK_LIBS=${SPARK_HOME}/lib
+SPARK_NODES=${@:2}
+
+cat > ${TMP_DIR}/init-conf.sh <<EOF
+#!/bin/bash
+
+if [ ! -f "${SPARK_HOME}/conf/spark-env.sh" ]; then
+  cp ${SPARK_HOME}/conf/spark-env.sh.template ${SPARK_HOME}/conf/spark-env.sh
+fi
+grep -F GREMLIN_LIBS ${SPARK_HOME}/conf/spark-env.sh > /dev/null || {
+  echo >> ${SPARK_HOME}/conf/spark-env.sh
+  echo "GREMLIN_LIBS=\\\$(find ${SPARK_LIBS}/${LIB_DIRNAME} -name '*.jar' | paste -sd ':')" >> ${SPARK_HOME}/conf/spark-env.sh
+  echo "export SPARK_CLASSPATH=\\\${SPARK_CLASSPATH}:\\\${GREMLIN_LIBS}" >> ${SPARK_HOME}/conf/spark-env.sh
+}
+EOF
+
+for node in ${SPARK_NODES}
+do
+  rsync -az --delete ${TMP_DIR2} ${node}:${SPARK_LIBS}
+  ssh ${node} "bash -s" -- < ${TMP_DIR}/init-conf.sh
+done
+
+rm -rf ${TMP_DIR}