ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntikho...@apache.org
Subject [31/50] incubator-ignite git commit: # ignite-1198
Date Tue, 11 Aug 2015 08:47:01 GMT
# ignite-1198


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

Branch: refs/heads/ignite-1108
Commit: 2173b0e1500d3dbc198a610042fca9b92d4f7de7
Parents: 023ffe0
Author: Alexey Goncharuk <agoncharuk@gridgain.com>
Authored: Wed Aug 5 14:05:07 2015 -0700
Committer: Alexey Goncharuk <agoncharuk@gridgain.com>
Committed: Wed Aug 5 14:25:13 2015 -0700

----------------------------------------------------------------------
 .../org/apache/ignite/spark/IgniteContext.scala  | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2173b0e1/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
----------------------------------------------------------------------
diff --git a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
index 5267244a..6e48017 100644
--- a/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
+++ b/modules/spark/src/main/scala/org/apache/ignite/spark/IgniteContext.scala
@@ -19,7 +19,8 @@ package org.apache.ignite.spark
 
 
 import org.apache.ignite.internal.IgnitionEx
-import org.apache.ignite.{Ignition, Ignite}
+import org.apache.ignite.internal.util.IgniteUtils
+import org.apache.ignite.{IgniteSystemProperties, Ignition, Ignite}
 import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}
 import org.apache.spark.{Logging, SparkContext}
 import org.apache.spark.sql.SQLContext
@@ -41,8 +42,12 @@ class IgniteContext[K, V](
 
     private val cfgClo = new Once(cfgF)
 
+    private val igniteHome = IgniteUtils.getIgniteHome
+
     if (!client) {
-        val workers = sparkContext.getExecutorStorageStatus.length - 1
+        // Get required number of executors with default equals to number of available executors.
+        val workers = sparkContext.getConf.getInt("spark.executor.instances",
+            sparkContext.getExecutorStorageStatus.length)
 
         if (workers <= 0)
             throw new IllegalStateException("No Spark executors found to start Ignite nodes.")
@@ -125,6 +130,16 @@ class IgniteContext[K, V](
      * @return Ignite instance.
      */
     def ignite(): Ignite = {
+        val home = IgniteUtils.getIgniteHome
+
+        if (home == null && igniteHome != null) {
+            logInfo("Setting IGNITE_HOME from driver not as it is not available on this worker:
" + igniteHome)
+
+            IgniteUtils.nullifyHomeDirectory()
+
+            System.setProperty(IgniteSystemProperties.IGNITE_HOME, igniteHome)
+        }
+
         val igniteCfg = cfgClo()
 
         try {


Mime
View raw message