Skip to content

Instantly share code, notes, and snippets.

@geoffkoh
Created January 26, 2020 06:38
Show Gist options
  • Save geoffkoh/1a983024c016c369557dad8376110111 to your computer and use it in GitHub Desktop.
Save geoffkoh/1a983024c016c369557dad8376110111 to your computer and use it in GitHub Desktop.
class ExecutorFactory:
""" The factory class for creating executors"""
registry = {}
""" Internal registry for available executors """
@classmethod
def create_executor(cls, name: str, **kwargs) -> 'ExecutorBase':
""" Factory command to create the executor """
exec_class = cls.registry[name]
executor = exec_class(**kwargs)
return executor
# end create_executor()
# end class ExecutorFactory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment