关注 spark技术分享,
撸spark源码 玩spark最佳实践

Local Properties — Creating Logical Job Groups

Local Properties — Creating Logical Job Groups

The purpose of local properties concept is to create logical groups of jobs by means of properties that (regardless of the threads used to submit the jobs) makes the separate jobs launched from different threads belong to a single logical group.

You can set a local property that will affect Spark jobs submitted from a thread, such as the Spark fair scheduler pool. You can use your own custom properties. The properties are propagated through to worker tasks and can be accessed there via TaskContext.getLocalProperty.

Note
Propagating local properties to workers starts when SparkContext is requested to run or submit a Spark job that in turn passes them along to DAGScheduler.

A common use case for the local property concept is to set a local property in a thread, say spark.scheduler.pool, after which all jobs submitted within the thread will be grouped, say into a pool by FAIR job scheduler.

Local Properties — localProperties Property

localProperties is a protected[spark] property of a SparkContext that are the properties through which you can create logical job groups.

Tip
Read up on Java’s java.lang.InheritableThreadLocal.

Setting Local Property — setLocalProperty Method

setLocalProperty sets key local property to value.

Tip
When value is null the key property is removed from localProperties.

Getting Local Property — getLocalProperty Method

getLocalProperty gets a local property by key in this thread. It returns null if key is missing.

Getting Local Properties — getLocalProperties Method

getLocalProperties is a private[spark] method that gives access to localProperties.

setLocalProperties Method

setLocalProperties is a private[spark] method that sets props as localProperties.

赞(0) 打赏
未经允许不得转载:spark技术分享 » Local Properties — Creating Logical Job Groups
分享到: 更多 (0)

关注公众号:spark技术分享

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏