Skip to content

Instantly share code, notes, and snippets.

@jonaslsl
Created January 17, 2024 17:59
Show Gist options
  • Save jonaslsl/097746cc8e2dd81c705739ecfb084e46 to your computer and use it in GitHub Desktop.
Save jonaslsl/097746cc8e2dd81c705739ecfb084e46 to your computer and use it in GitHub Desktop.
from prefect.flows import Flow
class AbstractClassBasedFlow:
"""
An example abstract class that shows how you can dynamically create prefect
flows.
"""
@classmethod
def run_config(cls):
...
@classmethod
def to_prefect_flow(cls):
"""
dynamically creates a prefect flow for us!
"""
return Flow(
fn=cls.run_config,
name=cls.__name__,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment