Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/771#discussion_r12807670
  
    --- Diff: core/src/main/scala/org/apache/spark/deploy/master/Master.scala 
---
    @@ -143,6 +146,9 @@ private[spark] class Master(
         leaderElectionAgent = RECOVERY_MODE match {
             case "ZOOKEEPER" =>
               context.actorOf(Props(classOf[ZooKeeperLeaderElectionAgent], 
self, masterUrl, conf))
    +        case "CUSTOM" =>
    +          val clazz = 
Class.forName(conf.get("spark.deploy.recoveryMode.leaderAgentActor"))
    +          context.actorOf(Props(clazz, self, masterUrl, conf))
    --- End diff --
    
    It may be a good idea to abstract out the creation of the persistenceEngine 
and leaderElectionAgent into something like
    ```scala
    abstract class StandaloneRecoveryModeFactory(conf: SparkConf) {
      def createPersistenceEngine(): PersistenceEngine
      def createLeaderElectionAgent(master: LeaderElectable, masterUrl: 
String): LeaderElectionAgent
    }
    ```
    
    with 2 subclasses, `FileSystemRecoveryModeFactory` and 
`ZooKeeperRecoveryModeFactory` (maybe the name "RecoveryModeFactory" is not so 
good).
    
    The advantage of this approach is that we formalize the arguments needed 
for constructing the 2 APIs, and centralize the creation of everything 
necessary for one recovery mode. Thoughts?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to