Skip to content

Commit

Permalink
Merge branch 'TRY'
Browse files Browse the repository at this point in the history
  • Loading branch information
allwefantasy committed Sep 23, 2020
2 parents e946caf + 947388f commit e9386a4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import tech.mlsql.version.VersionCompatibility
class App extends tech.mlsql.app.App with VersionCompatibility {
override def run(args: Seq[String]): Unit = {
AppRuntimeStore.store.registerController("/plugins/healthy", classOf[HealthyController].getName)
AppRuntimeStore.store.registerRequestCleaner("/plugins/cleaner/healthy",classOf[ShutdownOnSparkContextStoppedCleaner].getName)
}

override def supportedVersions: Seq[String] = Seq("1.5.0-SNAPSHOT", "1.5.0", "1.6.0-SNAPSHOT", "1.6.0")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package tech.mlsql.plugins.healthy

import streaming.dsl.ScriptSQLExec
import tech.mlsql.app.RequestCleaner

/**
* 23/9/2020 WilliamZhu([email protected])
*/
class ShutdownOnSparkContextStoppedCleaner extends RequestCleaner {
override def run(): Unit = {
val context = ScriptSQLExec.context()
val session = context.execListener.sparkSession
val wow = session.conf.get("spark.mlsql.plugins.healthy.shutdownOnSparkContextStoppedCleaner", "false").toBoolean
if (wow) {
if (session.sparkContext.isStopped) {
System.exit(-1)
}
}

}
}

0 comments on commit e9386a4

Please sign in to comment.