File tree Expand file tree Collapse file tree 3 files changed +41
-4
lines changed
Expand file tree Collapse file tree 3 files changed +41
-4
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,16 @@ impl SparkHistoryServer {
242242 let mut vars: BTreeMap < String , EnvVar > = BTreeMap :: new ( ) ;
243243 let role_env_overrides = & self . role ( ) . config . env_overrides ;
244244
245+ // Needed by the `containerdebug` running in the background of the history container
246+ // to log it's tracing information to.
247+ vars. insert (
248+ "CONTAINERDEBUG_LOG_DIRECTORY" . to_string ( ) ,
249+ EnvVar {
250+ name : "CONTAINERDEBUG_LOG_DIRECTORY" . to_string ( ) ,
251+ value : Some ( format ! ( "{VOLUME_MOUNT_PATH_LOG}/containerdebug" ) ) ,
252+ value_from : None ,
253+ } ,
254+ ) ;
245255 // This env var prevents the history server from detaching itself from the
246256 // start script because this leads to the Pod terminating immediately.
247257 vars. insert (
Original file line number Diff line number Diff line change @@ -692,6 +692,15 @@ impl SparkApplication {
692692 logdir : & Option < ResolvedLogDir > ,
693693 ) -> Vec < EnvVar > {
694694 let mut e: Vec < EnvVar > = self . spec . env . clone ( ) ;
695+
696+ // Needed by the `containerdebug` process running in the background of the `spark-submit`
697+ // container to log it's tracing information to.
698+ e. push ( EnvVar {
699+ name : "CONTAINERDEBUG_LOG_DIRECTORY" . to_string ( ) ,
700+ value : Some ( format ! ( "{VOLUME_MOUNT_PATH_LOG}/containerdebug" ) ) ,
701+ value_from : None ,
702+ } ) ;
703+
695704 if self . requirements ( ) . is_some ( ) {
696705 e. push ( EnvVar {
697706 name : "PYTHONPATH" . to_string ( ) ,
Original file line number Diff line number Diff line change @@ -612,11 +612,29 @@ fn pod_template(
612612 . resources ( config. resources . clone ( ) . into ( ) )
613613 . image_from_product_image ( spark_image) ;
614614
615- cb. add_env_var (
616- "_STACKABLE_PRE_HOOK" ,
617- format ! (
615+ // These env variables enable the `containerdebug` process in driver and executor pods.
616+ // More precisely, this process runs in the background of every `spark` container.
617+ // - `CONTAINERDEBUG_LOG_DIRECTORY` - is the location where tracing information from the process
618+ // is written. This directory is created by the process it's self.
619+ // - `_STACKABLE_PRE_HOOK` - is evaluated by the entrypoint script (run-spark.sh) in the Spark images
620+ // before the actual JVM process is started. The result of this evaluation is that the
621+ // `containerdebug` process is executed in the background.
622+ cb. add_env_vars (
623+ [
624+ EnvVar {
625+ name : "CONTAINERDEBUG_LOG_DIRECTORY" . into ( ) ,
626+ value : Some ( format ! ( "{VOLUME_MOUNT_PATH_LOG}/containerdebug" ) ) ,
627+ value_from : None ,
628+ } ,
629+ EnvVar {
630+ name : "_STACKABLE_PRE_HOOK" . into ( ) ,
631+ value : Some ( format ! (
618632 "containerdebug --output={VOLUME_MOUNT_PATH_LOG}/containerdebug-state.json --loop &"
619- ) ,
633+ ) ) ,
634+ value_from : None ,
635+ } ,
636+ ]
637+ . into ( ) ,
620638 ) ;
621639
622640 if config. logging . enable_vector_agent {
You can’t perform that action at this time.
0 commit comments