in bigtop-packages/src/charm/zeppelin/layer-zeppelin/reactive/zeppelin.py [0:0]
def configure_spark(spark):
'''
Configure Zeppelin to use remote Spark resources.
'''
# NB: Use the master_url string if it already starts with spark://.
# Otherwise, it means the remote spark is in local or yarn mode -- that's
# bad because using 'local' or 'yarn' here would cause zepp's spark-submit
# to use the builtin spark, hence ignoring the remote spark. In this case,
# set a state so we can inform the user that the remote spark is unusable.
master_url = spark.get_master_url()
if master_url.startswith('spark'):
remove_state('spark.master.unusable')
# Only (re)configure if our master url has changed.
if data_changed('spark.master', master_url):
hookenv.status_set('maintenance', 'configuring spark')
zeppelin = Zeppelin()
zeppelin.configure_spark(master_url)
set_state('zeppelin.spark.configured')
else:
remove_state('zeppelin.spark.configured')
set_state('spark.master.unusable')
update_status()