@@ -468,7 +468,6 @@ impl datafusion::config::ConfigExtension for BallistaConfig {
468468/// Ballista supports both push-based and pull-based task scheduling.
469469/// It is recommended that you try both to determine which is the best for your use case.
470470#[ derive( Clone , Copy , Debug , serde:: Deserialize , Default ) ]
471- #[ cfg_attr( feature = "build-binary" , derive( clap:: ValueEnum ) ) ]
472471pub enum TaskSchedulingPolicy {
473472 /// Pull-based scheduling works in a similar way to Apache Spark
474473 #[ default]
@@ -485,18 +484,23 @@ impl Display for TaskSchedulingPolicy {
485484 }
486485}
487486
488- #[ cfg( feature = "build-binary" ) ]
489487impl std:: str:: FromStr for TaskSchedulingPolicy {
490488 type Err = String ;
491489
492490 fn from_str ( s : & str ) -> std:: result:: Result < Self , Self :: Err > {
493- clap:: ValueEnum :: from_str ( s, true )
491+ match s. to_lowercase ( ) . as_str ( ) {
492+ "pull-staged" | "pullstaged" => Ok ( TaskSchedulingPolicy :: PullStaged ) ,
493+ "push-staged" | "pushstaged" => Ok ( TaskSchedulingPolicy :: PushStaged ) ,
494+ _ => Err ( format ! (
495+ "Invalid scheduling policy '{}'. Valid options: 'pull-staged', 'push-staged'" ,
496+ s
497+ ) ) ,
498+ }
494499 }
495500}
496501
497502/// Configures the log file rotation policy.
498503#[ derive( Clone , Copy , Debug , serde:: Deserialize , Default ) ]
499- #[ cfg_attr( feature = "build-binary" , derive( clap:: ValueEnum ) ) ]
500504pub enum LogRotationPolicy {
501505 /// Rotate log files every minute.
502506 Minutely ,
@@ -520,12 +524,20 @@ impl Display for LogRotationPolicy {
520524 }
521525}
522526
523- #[ cfg( feature = "build-binary" ) ]
524527impl std:: str:: FromStr for LogRotationPolicy {
525528 type Err = String ;
526529
527530 fn from_str ( s : & str ) -> std:: result:: Result < Self , Self :: Err > {
528- clap:: ValueEnum :: from_str ( s, true )
531+ match s. to_lowercase ( ) . as_str ( ) {
532+ "minutely" => Ok ( LogRotationPolicy :: Minutely ) ,
533+ "hourly" => Ok ( LogRotationPolicy :: Hourly ) ,
534+ "daily" => Ok ( LogRotationPolicy :: Daily ) ,
535+ "never" => Ok ( LogRotationPolicy :: Never ) ,
536+ _ => Err ( format ! (
537+ "Invalid rotation policy '{}'. Valid options: 'minutely', 'hourly', 'daily', 'never'" ,
538+ s
539+ ) ) ,
540+ }
529541 }
530542}
531543
0 commit comments