[SPARK-33249][CORE][UI] Add status plugin for live application #30158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
AppLiveStatusPluginfor live application to create extra listeners that can write a given store.spark.appLiveStatusPlugins, to specify whatAppLiveStatusPluginshould be loaded.AppLiveStatusPluginusingUtils.loadExtensions, then create and register listeners.Why are the changes needed?
There are cases that developers may want to extend the current REST API of Web UI. In most of these cases, adding external module is a better option than directly editing the original Spark code.
For an external module, to extend the REST API of the Web UI, 2 things may need to be done:
ApiRequestContextwhich will be automatically loaded.For history server, there is an interface called
AppHistoryServerPlugin, which is loaded based on SPI, providing a method to create listeners. In live application, the only way isspark.extraListenersbased onUtils.loadExtensions. But this is not enough for the cases.To let the API get the status info, the data need to be written to the
AppStatusStore, which is the only store that an API can get by accessingui.storeorui.sc.statusStore. But listeners created byUtils.loadExtensionsonly get aSparkConfin construction, and are unable to write theAppStatusStore.So I think we still need plugin like
AppHistorySeverfor live UI. For concerns like SPARK-22786, the plugin for live app can be separated from the history server one, and also loaded using Utils.loadExtensions with an extra configurations. So by default, nothing will be loaded.Does this PR introduce any user-facing change?
Yes, a new configuration property called
spark.appLiveStatusPlugins, indicating allAppLiveStatusPluginto load.How was this patch tested?
Tested using existed UT.
Also add tests for
AppLiveStatusPluginto make sure plugins inspark.appLiveStatusPluginswill be loaded and listeners will be created and registered.