From 517dc3ed91a4f6363526b883a422075cbb563908 Mon Sep 17 00:00:00 2001 From: Jeremiah Lowin <153965+jlowin@users.noreply.github.com> Date: Wed, 11 Sep 2024 13:10:58 -0400 Subject: [PATCH] Use prefect ephemeral mode --- src/controlflow/settings.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/controlflow/settings.py b/src/controlflow/settings.py index beb8054f..e47ce477 100644 --- a/src/controlflow/settings.py +++ b/src/controlflow/settings.py @@ -119,6 +119,18 @@ class Settings(ControlFlowSettings): alias="PREFECT_LOGGING_LEVEL", ) + prefect_api_url: Optional[str] = Field( + default=None, + description="The URL for the Prefect API. Leave unset to use an ephemeral API.", + alias="PREFECT_API_URL", + ) + + prefect_server_allow_ephemeral_mode: bool = Field( + default=True, + description="If True, ephemeral mode will be allowed for Prefect Server.", + alias="PREFECT_SERVER_ALLOW_EPHEMERAL_MODE", + ) + _prefect_context: contextmanager = None @field_validator("home_path", mode="before") @@ -145,7 +157,11 @@ def _apply_prefect_settings(self): self._prefect_context.__exit__(None, None, None) self._prefect_context = None - settings_map = {"prefect_log_level": prefect.settings.PREFECT_LOGGING_LEVEL} + settings_map = { + "prefect_log_level": prefect.settings.PREFECT_LOGGING_LEVEL, + "prefect_api_url": prefect.settings.PREFECT_API_URL, + "prefect_server_allow_ephemeral_mode": prefect.settings.PREFECT_SERVER_ALLOW_EPHEMERAL_MODE, + } prefect_settings = {}