[DATAFLINT-4359] Add executor metadata collection plugin#62
Open
[DATAFLINT-4359] Add executor metadata collection plugin#62
Conversation
Implement an ExecutorPlugin that collects machine metadata from each executor and reports it to the driver. When enabled via spark.dataflint.executor.metadata.enabled, each executor detects its cloud provider by reading /sys/class/dmi/id/sys_vendor, then fetches instance type and spot/on-demand status from the cloud metadata API. System basics (OS, JVM, CPU cores, memory) are always collected. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Return null from DriverPlugin.receive() since PluginContext.send() is fire-and-forget — returning a string caused a spurious warning. Relax broadcast join test assertions to duration >= 0 because the codegen sleep is only in doProduce path, not doExecute which broadcast joins use. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`spark.dataflint.experimental.executor.metadata.enabled`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds executor metadata collection to the DataFlint Spark plugin, enabling automatic detection of cloud instance type, spot/on-demand lifecycle, and system basics from each executor.
PluginContext.send()/DriverPlugin.receive())/sys/class/dmi/id/sys_vendorlocally to identify AWS/GCP/Azure — no blind HTTP probingspark.dataflint.executor.metadata.enabled=true(default: false)Changed files
executor/CloudMetadataDetector.scala/sys/class/dmi/id/sys_vendor, then runs provider-specific bash to get instance type + lifecycleexecutor/DataflintExecutorPlugin.scalaexecutor/ExecutorMetadataMessage.scalaexecutor/DriverMetadataHelper.scalaprivate[spark]APIs (config, listener bus) fromio.dataflint.sparkpackagelistener/model.scalaDataflintExecutorMetadataInfo,DataflintExecutorMetadataEvent,DataflintExecutorMetadataWrapperlistener/DataflintListener.scalaDataflintExecutorMetadataEventinonOtherEvent()listener/DataflintStore.scalaexecutorMetadata()query methodsaas/SparkRunStore.scaladataflintExecutorMetadatafield to export data modelsaas/StoreDataExtractor.scalareadAll[DataflintExecutorMetadataWrapper]to extractionSparkDataflintPlugin.scala(spark3 + spark4)DataflintExecutorPlugin, passes config viaextraConf, addsreceive()handlerArchitecture
sequenceDiagram participant Driver as Driver (SparkDataflintDriverPlugin) participant Executor as Executor (DataflintExecutorPlugin) participant Cloud as Cloud Metadata API Driver->>Executor: init(extraConf: {executor.metadata.enabled: true}) Executor->>Executor: Collect system basics (OS, JVM, cores, memory) Executor->>Executor: Read /sys/class/dmi/id/sys_vendor alt AWS detected Executor->>Cloud: curl EC2 IMDS (instance-type, instance-life-cycle) else GCP detected Executor->>Cloud: curl GCP metadata (machine-type, preemptible) else Azure detected Executor->>Cloud: curl Azure IMDS (vmSize, priority) else No cloud Executor->>Executor: Skip cloud metadata end Executor->>Driver: PluginContext.send(ExecutorMetadataMessage) Driver->>Driver: receive() → post DataflintExecutorMetadataEvent Driver->>Driver: DataflintListener → KVStore Driver->>Driver: StoreDataExtractor → SparkRunStore → S3 exportCloud Detection Flow
flowchart TD A[Read /sys/class/dmi/id/sys_vendor] --> B{Vendor?} B -->|Contains 'Amazon'| C[Run AWS metadata command] B -->|Contains 'Google'| D[Run GCP metadata command] B -->|Contains 'Microsoft'| E[Run Azure metadata command] B -->|File missing / unknown| F[Return None — system basics only] C --> G[instanceType + lifecycleType] D --> G E --> GCollected Metadata
executorIdexecutorHostInetAddress.getLocalHostosNameSystem.getProperty("os.name")osArchSystem.getProperty("os.arch")jvmVersionSystem.getProperty("java.version")availableProcessorsRuntime.availableProcessors()totalMemoryBytesRuntime.maxMemory()cloudProvider/sys/class/dmi/id/sys_vendorinstanceTypelifecycleTypecollectionErrorTest plan
sbt pluginspark3/compilepassessbt pluginspark4/compilepassessbt pluginspark3/test— all 43 existing tests passspark.dataflint.executor.metadata.enabled=truedataflintExecutorMetadatafield)🤖 Generated with Claude Code