Skip to content
This repository was archived by the owner on Oct 8, 2020. It is now read-only.

Commit 4cf3a5d

Browse files
committed
Workaround for non-existing /tmp/spark-events folder bug
1 parent a1bc1fe commit 4cf3a5d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

sansa-query-spark-parent/sansa-query-spark-server/src/main/scala/net/sansa_stack/query/spark/server/MainSansaSparqlServer.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ import scala.collection.JavaConverters._
3737
import org.aksw.sparqlify.algebra.sql.nodes.SqlOpTable
3838
import org.apache.spark.sql.catalyst.ScalaReflection
3939
import net.sansa_stack.rdf.partition.sparqlify.SparqlifyUtils2
40+
import java.io.File
41+
import java.nio.file.Files
4042

4143

4244
object MainSansaSparqlServer
@@ -45,6 +47,17 @@ object MainSansaSparqlServer
4547

4648
def main(args: Array[String]): Unit = {
4749

50+
val tempDirStr = System.getProperty("java.io.tmpdir")
51+
if(tempDirStr == null) {
52+
throw new RuntimeException("Could not obtain temporary directory")
53+
}
54+
val sparkEventsDir = new File(tempDirStr + "/spark-events")
55+
if(!sparkEventsDir.exists()) {
56+
sparkEventsDir.mkdirs()
57+
}
58+
59+
//File.createTempFile("spark-events")
60+
4861
val sparkSession = SparkSession.builder
4962
.master("local")
5063
.appName("spark session example")

0 commit comments

Comments
 (0)