Skip to content

Commit

Permalink
Remove Gisaia's spark app interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien FALQUIER committed Jul 15, 2021
1 parent 78f8afb commit a9e2f11
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 353 deletions.
8 changes: 1 addition & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,9 @@ docker run -ti \
--conf spark.es.index.auto.create="true" \
--conf spark.cassandra.connection.host="gisaia-scylla-db" \
--conf spark.driver.allowMultipleContexts="true" \
--conf spark.rpc.netty.dispatcher.numThreads="2" \
--conf spark.driver.CLOUDSMITH_ML_MODELS_TOKEN="$CLOUDSMITH_PRIVATE_TOKEN" \
--conf spark.driver.CLOUDSMITH_ML_MODELS_REPO="gisaia/private"
--conf spark.rpc.netty.dispatcher.numThreads="2"
```

`spark.driver.CLOUDSMITH_ML_MODELS_REPO` and `spark.driver.CLOUDSMITH_ML_MODELS_TOKEN` are required when using ML models from Cloudsmith.

CLOUDSMITH_ML_MODELS_REPO is the repo hosting the models (e.g. `gisaia/private`), and CLOUDSMITH_ML_MODELS_TOKEN is the token to use to download from this repository.

Paste (using `:paste`) the following code snippet :
```scala
import io.arlas.data.sql._
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ThisBuild / scalaVersion := "2.11.8"
ThisBuild / organization := "io.arlas"

resolvers += "osgeo" at "https://repo.osgeo.org/repository/release/"
resolvers += "gisaia-ml" at "https://dl.cloudsmith.io/public/gisaia/public/maven/"
resolvers += "gisaia" at "https://dl.cloudsmith.io/public/gisaia/public/maven/"
resolvers += "jboss" at "https://repository.jboss.org/maven2/"

val sparkVersion = "2.3.3"
Expand Down
51 changes: 0 additions & 51 deletions src/main/scala/io/arlas/data/app/ArlasProcConfig.scala

This file was deleted.

89 changes: 0 additions & 89 deletions src/main/scala/io/arlas/data/app/BasicApp.scala

This file was deleted.

30 changes: 1 addition & 29 deletions src/main/scala/io/arlas/data/model/MLModel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@

package io.arlas.data.model

import java.security.InvalidParameterException

import io.arlas.data.app.ArlasProcConfig
import io.arlas.data.utils.RestTool
import org.apache.spark.sql.SparkSession

import scala.util.{Failure, Try}

abstract sealed class MLModel {
abstract class MLModel {
def getModelString(): Try[String]
}

Expand All @@ -37,27 +33,3 @@ case class MLModelLocal(spark: SparkSession, path: String) extends MLModel {
Try(spark.sparkContext.textFile(path, 1).toLocalIterator.mkString)
}
}

case class MLModelHosted(spark: SparkSession, project: String, modelName: String, version: String = "latest") extends MLModel {

val CLOUDSMITH_TOKEN_KEY = "spark.driver.CLOUDSMITH_ML_MODELS_TOKEN"
val CLOUDSMITH_REPO_KEY = "spark.driver.CLOUDSMITH_ML_MODELS_REPO"

override def getModelString(): Try[String] = {

val cloudsmithToken = Try(spark.conf.get(CLOUDSMITH_TOKEN_KEY)).toOption
val cloudsmithRepo = Try(spark.conf.get(CLOUDSMITH_REPO_KEY)).toOption

if (!cloudsmithToken.isDefined) {
Failure(
new InvalidParameterException(s"${CLOUDSMITH_TOKEN_KEY} conf not set, cannot download ML Model ${modelName}:${version}/${project}"))
} else if (!cloudsmithRepo.isDefined) {
Failure(
new InvalidParameterException(s"${CLOUDSMITH_REPO_KEY} conf not set, cannot download ML Model ${modelName}:${version}/${project}"))
} else {
RestTool.get(ArlasProcConfig.getCloudsmithModelUrl(cloudsmithToken.get, cloudsmithRepo.get, version, project, modelName))
}

}

}
28 changes: 0 additions & 28 deletions src/main/scala/io/arlas/data/model/runoptions/RunOptions.scala

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit a9e2f11

Please sign in to comment.