Skip to content

Commit 59b8307

Browse files
committed
Merge pull request spark-jobserver#183 from spark-jobserver/velvia/fix-streaming-docs
A docs fix, and enable env vars in Typesafe configs
2 parents 335b217 + aa15b17 commit 59b8307

File tree

7 files changed

+28
-20
lines changed

7 files changed

+28
-20
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ See [Troubleshooting Tips](doc/troubleshooting.md) as well as [Yarn tips](doc/ya
1919
- Fuse Elements
2020
- Frontline Solvers
2121
- Aruba Networks
22+
- [Zed Worldwide](www.zed.com)
2223

2324
## Features
2425

@@ -48,7 +49,7 @@ For release notes, look in the `notes/` directory. They should also be up on [l
4849

4950
## Quick start / development mode
5051

51-
NOTE: This quick start guide uses SBT to run the job server and the included test jar, but the normal development process is to create a separate project for Job Server jobs and to deploy the job server to a Spark cluster.
52+
NOTE: This quick start guide uses SBT to run the job server and the included test jar, but the normal development process is to create a separate project for Job Server jobs and to deploy the job server to a Spark cluster. Please see the deployment section below for more details.
5253

5354
You need to have [SBT](http://www.scala-sbt.org/release/docs/Getting-Started/Setup.html) installed.
5455

@@ -281,6 +282,8 @@ the REST API.
281282
DELETE /jobs/<jobId> - Kills the specified job
282283
GET /jobs/<jobId>/config - Gets the job configuration
283284

285+
For details on the Typesafe config format used for input (JSON also works), see the [Typesafe Config docs](https://github.com/typesafehub/config).
286+
284287
### Context configuration
285288

286289
A number of context-specific settings can be controlled when creating a context (POST /contexts) or running an

doc/contexts.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ This can be done easily by extending the `SparkContextFactory` trait, like `SQLC
4040

4141
If you wish to use the `SQLContext` or `HiveContext`, be sure to pull down the job-server-extras package.
4242

43-
# StreamingContext
44-
job-server-extras provides a context to run Spark Streaming jobs, there are a couple of configurations you can change in job-server's .conf file
45-
streaming.batch_interval: the streaming batch in millis
46-
streaming.stopGracefully: if true, stops gracefully by waiting for the processing of all received data to be completed
47-
streaming.stopSparkContext: if true, stops the SparkContext with the StreamingContext. The underlying SparkContext will be stopped regardless of whether the StreamingContext has been started.
43+
## StreamingContext
44+
45+
`job-server-extras` provides a context to run Spark Streaming jobs. There are a couple of configurations you can change in job-server's .conf file:
46+
47+
* `streaming.batch_interval`: the streaming batch in millis
48+
* `streaming.stopGracefully`: if true, stops gracefully by waiting for the processing of all received data to be completed
49+
* `streaming.stopSparkContext`: if true, stops the SparkContext with the StreamingContext. The underlying SparkContext will be stopped regardless of whether the StreamingContext has been started.
4850

job-server-extras/src/spark.jobserver/StreamingTestJob.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ import org.apache.spark.streaming.StreamingContext
77

88
import scala.collection.mutable
99

10-
/** :: TestObject ::
11-
* A Streaming job for testing, will
12-
*/
1310
@VisibleForTesting
1411
object StreamingTestJob extends SparkStramingJob {
1512
def validate(ssc: StreamingContext, config: Config): SparkJobValidation = SparkJobValid

job-server/src/main/resources/application.conf

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ spark {
5454
# Determines the type of jobs that can run in a SparkContext
5555
context-factory = spark.jobserver.context.DefaultSparkContextFactory
5656

57-
# Default batch interval for Spark Streaming contexts in milliseconds
58-
streaming.batch_interval = 1000
59-
# if true, stops gracefully by waiting for the processing of all received data to be completed
60-
streaming.stopGracefully = true
61-
# if true, stops the SparkContext with the StreamingContext. The underlying SparkContext will be
62-
# stopped regardless of whether the StreamingContext has been started.
63-
streaming.stopSparkContext = true
57+
58+
streaming {
59+
# Default batch interval for Spark Streaming contexts in milliseconds
60+
batch_interval = 1000
61+
62+
# if true, stops gracefully by waiting for the processing of all received data to be completed
63+
stopGracefully = true
64+
65+
# if true, stops the SparkContext with the StreamingContext. The underlying SparkContext will be
66+
# stopped regardless of whether the StreamingContext has been started.
67+
stopSparkContext = true
68+
}
6469

6570
# uris of jars to be loaded into the classpath for this context. Uris is a string list, or a string separated by commas ','
6671
# dependent-jar-uris = ["file:///some/path/present/in/each/mesos/slave/somepackage.jar"]

job-server/src/spark.jobserver/JobServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object JobServer {
3636
println("Could not find configuration file " + configFile)
3737
sys.exit(1)
3838
}
39-
ConfigFactory.parseFile(configFile).withFallback(defaultConfig)
39+
ConfigFactory.parseFile(configFile).withFallback(defaultConfig).resolve()
4040
} else {
4141
defaultConfig
4242
}

job-server/src/spark.jobserver/WebApi.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class WebApi(system: ActorSystem,
117117
complete(StatusCodes.BadRequest, errMap("context name must start with letters"))
118118
} else {
119119
parameterMap { (params) =>
120-
val config = ConfigFactory.parseMap(params.asJava)
120+
val config = ConfigFactory.parseMap(params.asJava).resolve()
121121
val future = (supervisor ? AddContext(contextName, config))(contextTimeout.seconds)
122122
respondWithMediaType(MediaTypes.`application/json`) { ctx =>
123123
future.map {
@@ -290,7 +290,7 @@ class WebApi(system: ActorSystem,
290290
try {
291291
val async = !syncOpt.getOrElse(false)
292292
val postedJobConfig = ConfigFactory.parseString(configString)
293-
val jobConfig = postedJobConfig.withFallback(config)
293+
val jobConfig = postedJobConfig.withFallback(config).resolve()
294294
val contextConfig = Try(jobConfig.getConfig("spark.context-settings")).
295295
getOrElse(ConfigFactory.empty)
296296
val jobManager = getJobManagerForContext(contextOpt, contextConfig, classPath)

notes/0.5.2.markdown

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#Scala #akka @ApacheSpark
22

33
* Spark streaming context support !! (@zeitos)
4-
* Change `server_start.sh` to use `spark-submit`
4+
* Change `server_start.sh` to use `spark-submit`. This should fix some edge case bugs.
55
* Configurable driver memory (@acidghost)
6+
* Be able to accept environment vars in job server config files, eg `master = ${?MY_SPARK_HOST}` (see the [Typesafe Config docs](https://github.com/typesafehub/config#uses-of-substitutions))

0 commit comments

Comments
 (0)