prefect.settings
¶
Prefect settings management.
Each setting is defined as a Setting
type. The name of each setting is stylized in all
caps, matching the environment variable that can be used to change the setting.
All settings defined in this file are used to generate a dynamic Pydantic settings class
called Settings
. When insantiated, this class will load settings from environment
variables and pull default values from the setting definitions.
The current instance of Settings
being used by the application is stored in a
SettingsContext
model which allows each instance of the Settings
class to be
accessed in an async-safe manner.
Aside from environment variables, we allow settings to be changed during the runtime of the process using profiles. Profiles contain setting overrides that the user may persist without setting environment variables. Profiles are also used internally for managing settings during task run execution where differing settings may be used concurrently in the same process and during testing where we need to override settings to ensure their value is respected as intended.
The SettingsContext
is set when the prefect
module is imported. This context is
referred to as the "root" settings context for clarity. Generally, this is the only
settings context that will be used. When this context is entered, we will instantiate
a Settings
object, loading settings from environment variables and defaults, then we
will load the active profile and use it to override settings. See enter_root_settings_context
for details on determining the active profile.
Another SettingsContext
may be entered at any time to change the settings being
used by the code within the context. Generally, users should not use this. Settings
management should be left to Prefect application internals.
Generally, settings should be accessed with SETTING_VARIABLE.value()
which will
pull the current Settings
instance from the current SettingsContext
and retrieve
the value of the relevant setting.
Accessing a setting's value will also call the Setting.value_callback
which allows
settings to be dynamically modified on retrieval. This allows us to make settings
dependent on the value of other settings or perform other dynamic effects.
PREFECT_HOME = Setting(Path, default=Path('~') / '.prefect', value_callback=expanduser_in_path)
module-attribute
¶
Prefect's home directory. Defaults to ~/.prefect
. This
directory may be created automatically when required.
PREFECT_EXTRA_ENTRYPOINTS = Setting(str, default='')
module-attribute
¶
Modules for Prefect to import when Prefect is imported.
Values should be separated by commas, e.g. my_module,my_other_module
.
Objects within modules may be specified by a ':' partition, e.g. my_module:my_object
.
If a callable object is provided, it will be called with no arguments on import.
PREFECT_DEBUG_MODE = Setting(bool, default=False)
module-attribute
¶
If True
, places the API in debug mode. This may modify
behavior to facilitate debugging, including extra logs and other verbose
assistance. Defaults to False
.
PREFECT_CLI_COLORS = Setting(bool, default=True)
module-attribute
¶
If True
, use colors in CLI output. If False
,
output will not include colors codes. Defaults to True
.
PREFECT_CLI_WRAP_LINES = Setting(bool, default=True)
module-attribute
¶
If True
, wrap text by inserting new lines in long lines
in CLI output. If False
, output will not be wrapped. Defaults to True
.
PREFECT_TEST_MODE = Setting(bool, default=False)
module-attribute
¶
If True
, places the API in test mode. This may modify
behavior to faciliate testing. Defaults to False
.
PREFECT_TEST_SETTING = Setting(Any, default=None, value_callback=only_return_value_in_test_mode)
module-attribute
¶
This variable only exists to faciliate testing of settings.
If accessed when PREFECT_TEST_MODE
is not set, None
is returned.
PREFECT_API_TLS_INSECURE_SKIP_VERIFY = Setting(bool, default=False)
module-attribute
¶
If True
, disables SSL checking to allow insecure requests.
This is recommended only during development, e.g. when using self-signed certificates.
PREFECT_API_URL = Setting(str, default=None)
module-attribute
¶
If provided, the URL of a hosted Prefect API. Defaults to None
.
When using Prefect Cloud, this will include an account and workspace.
PREFECT_API_KEY = Setting(str, default=None, is_secret=True)
module-attribute
¶
API key used to authenticate with a the Prefect API. Defaults to None
.
PREFECT_API_ENABLE_HTTP2 = Setting(bool, default=True)
module-attribute
¶
If true, enable support for HTTP/2 for communicating with an API.
If the API does not support HTTP/2, this will have no effect and connections will be made via HTTP/1.1.
PREFECT_CLOUD_API_URL = Setting(str, default='https://api.prefect.cloud/api', value_callback=check_for_deprecated_cloud_url)
module-attribute
¶
API URL for Prefect Cloud. Used for authentication.
PREFECT_CLOUD_URL = Setting(str, default=None, deprecated=True, deprecated_start_date='Dec 2022', deprecated_help='Use `PREFECT_CLOUD_API_URL` instead.')
module-attribute
¶
PREFECT_UI_URL = Setting(Optional[str], default=None, value_callback=default_ui_url)
module-attribute
¶
The URL for the UI. By default, this is inferred from the PREFECT_API_URL.
When using Prefect Cloud, this will include the account and workspace.
When using an ephemeral server, this will be None
.
PREFECT_CLOUD_UI_URL = Setting(str, default=None, value_callback=default_cloud_ui_url)
module-attribute
¶
The URL for the Cloud UI. By default, this is inferred from the PREFECT_CLOUD_API_URL.
PREFECT_UI_URL will be workspace specific and will be usable in the open source too.
In contrast, this value is only valid for Cloud and will not include the workspace.
PREFECT_API_REQUEST_TIMEOUT = Setting(float, default=30.0)
module-attribute
¶
The default timeout for requests to the API
PREFECT_EXPERIMENTAL_WARN = Setting(bool, default=True)
module-attribute
¶
If enabled, warn on usage of expirimental features.
PREFECT_PROFILES_PATH = Setting(Path, default=Path('${PREFECT_HOME}') / 'profiles.toml', value_callback=template_with_settings(PREFECT_HOME))
module-attribute
¶
The path to a profiles configuration files.
PREFECT_RESULTS_DEFAULT_SERIALIZER = Setting(str, default='pickle')
module-attribute
¶
The default serializer to use when not otherwise specified.
PREFECT_RESULTS_PERSIST_BY_DEFAULT = Setting(bool, default=False)
module-attribute
¶
The default setting for persisting results when not otherwise specified. If enabled, flow and task results will be persisted unless they opt out.
PREFECT_TASKS_REFRESH_CACHE = Setting(bool, default=False)
module-attribute
¶
If True
, enables a refresh of cached results: re-executing the
task will refresh the cached results. Defaults to False
.
PREFECT_LOCAL_STORAGE_PATH = Setting(Path, default=Path('${PREFECT_HOME}') / 'storage', value_callback=template_with_settings(PREFECT_HOME))
module-attribute
¶
The path to a directory to store things in.
PREFECT_MEMO_STORE_PATH = Setting(Path, default=Path('${PREFECT_HOME}') / 'memo_store.toml', value_callback=template_with_settings(PREFECT_HOME))
module-attribute
¶
The path to the memo store file.
PREFECT_MEMOIZE_BLOCK_AUTO_REGISTRATION = Setting(bool, default=True)
module-attribute
¶
Controls whether or not block auto-registration on start up should be memoized. Setting to False may result in slower server start up times.
PREFECT_LOGGING_LEVEL = Setting(str, default='INFO', value_callback=debug_mode_log_level)
module-attribute
¶
The default logging level for Prefect loggers. Defaults to "INFO" during normal operation. Is forced to "DEBUG" during debug mode.
PREFECT_LOGGING_SERVER_LEVEL = Setting(str, default='WARNING')
module-attribute
¶
The default logging level for the Prefect API server.
PREFECT_LOGGING_SETTINGS_PATH = Setting(Path, default=Path('${PREFECT_HOME}') / 'logging.yml', value_callback=template_with_settings(PREFECT_HOME))
module-attribute
¶
The path to a custom YAML logging configuration file. If
no file is found, the default logging.yml
is used.
Defaults to a logging.yml in the Prefect home directory.
PREFECT_LOGGING_EXTRA_LOGGERS = Setting(str, default='', value_callback=get_extra_loggers)
module-attribute
¶
Additional loggers to attach to Prefect logging at runtime. Values should be comma separated. The handlers attached to the 'prefect' logger will be added to these loggers. Additionally, if the level is not set, it will be set to the same level as the 'prefect' logger.
PREFECT_LOGGING_LOG_PRINTS = Setting(bool, default=False)
module-attribute
¶
If set, print
statements in flows and tasks will be redirected to the Prefect logger
for the given run. This setting can be overriden by individual tasks and flows.
PREFECT_LOGGING_TO_API_ENABLED = Setting(bool, default=True)
module-attribute
¶
Toggles sending logs to the API.
If False
, logs sent to the API log handler will not be sent to the API.
PREFECT_LOGGING_TO_API_BATCH_INTERVAL = Setting(float, default=2.0)
module-attribute
¶
The number of seconds between batched writes of logs to the API.
PREFECT_LOGGING_TO_API_BATCH_SIZE = Setting(int, default=4000000)
module-attribute
¶
The maximum size in bytes for a batch of logs.
PREFECT_LOGGING_TO_API_MAX_LOG_SIZE = Setting(int, default=1000000)
module-attribute
¶
The maximum size in bytes for a single log.
PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW = Setting(Literal['warn', 'error', 'ignore'], default='warn')
module-attribute
¶
Controls the behavior when loggers attempt to send logs to the API handler from outside of a flow.
All logs sent to the API must be associated with a flow run. The API log handler can only be used outside of a flow by manually providing a flow run identifier. Logs that are not associated with a flow run will not be sent to the API. This setting can be used to determine if a warning or error is displayed when the identifier is missing.
The following options are available:
- "warn": Log a warning message.
- "error": Raise an error.
- "ignore": Do not log a warning message or raise an error.
PREFECT_LOGGING_COLORS = Setting(bool, default=True)
module-attribute
¶
Whether to style console logs with color.
PREFECT_LOGGING_MARKUP = Setting(bool, default=False)
module-attribute
¶
Whether to interpret strings wrapped in square brackets as a style.
This allows styles to be conveniently added to log messages, e.g.
[red]This is a red message.[/red]
. However, the downside is,
if enabled, strings that contain square brackets may be inaccurately
interpreted and lead to incomplete output, e.g.
DROP TABLE [dbo].[SomeTable];"
outputs DROP TABLE .[SomeTable];
.
PREFECT_AGENT_QUERY_INTERVAL = Setting(float, default=10)
module-attribute
¶
The agent loop interval, in seconds. Agents will check for new runs this often.
Defaults to 10
.
PREFECT_AGENT_PREFETCH_SECONDS = Setting(int, default=10)
module-attribute
¶
Agents will look for scheduled runs this many seconds in
the future and attempt to run them. This accounts for any additional
infrastructure spin-up time or latency in preparing a flow run. Note
flow runs will not start before their scheduled time, even if they are
prefetched. Defaults to 10
.
PREFECT_ASYNC_FETCH_STATE_RESULT = Setting(bool, default=False)
module-attribute
¶
Determines whether State.result()
fetches results automatically or not.
In Prefect 2.6.0, the State.result()
method was updated to be async
to faciliate automatic retrieval of results from storage which means when
writing async code you must await
the call. For backwards compatibility,
the result is not retrieved by default for async users. You may opt into this
per call by passing fetch=True
or toggle this setting to change the behavior
globally.
This setting does not affect users writing synchronous tasks and flows.
This setting does not affect retrieval of results when using Future.result()
.
PREFECT_API_BLOCKS_REGISTER_ON_START = Setting(bool, default=True)
module-attribute
¶
If set, any block types that have been imported will be registered with the backend on application startup. If not set, block types must be manually registered.
PREFECT_API_DATABASE_PASSWORD = Setting(str, default=None, is_secret=True)
module-attribute
¶
Password to template into the PREFECT_API_DATABASE_CONNECTION_URL
.
This is useful if the password must be provided separately from the connection URL.
To use this setting, you must include it in your connection URL.
PREFECT_API_DATABASE_CONNECTION_URL = Setting(str, default=None, value_callback=default_database_connection_url, is_secret=True)
module-attribute
¶
A database connection URL in a SQLAlchemy-compatible
format. Prefect currently supports SQLite and Postgres. Note that all
Prefect database engines must use an async driver - for SQLite, use
sqlite+aiosqlite
and for Postgres use postgresql+asyncpg
.
SQLite in-memory databases can be used by providing the url
sqlite+aiosqlite:///file::memory:?cache=shared&uri=true&check_same_thread=false
,
which will allow the database to be accessed by multiple threads. Note
that in-memory databases can not be accessed from multiple processes and
should only be used for simple tests.
Defaults to a sqlite database stored in the Prefect home directory.
If you need to provide password via a different environment variable, you use
the PREFECT_API_DATABASE_PASSWORD
setting. For example:
PREFECT_API_DATABASE_PASSWORD='mypassword'
PREFECT_API_DATABASE_CONNECTION_URL='postgresql+asyncpg://postgres:${PREFECT_API_DATABASE_PASSWORD}@localhost/prefect'
PREFECT_API_DATABASE_ECHO = Setting(bool, default=False)
module-attribute
¶
If True
, SQLAlchemy will log all SQL issued to the database. Defaults to False
.
PREFECT_API_DATABASE_MIGRATE_ON_START = Setting(bool, default=True)
module-attribute
¶
If True
, the database will be upgraded on application creation. If False
, the database will need to be upgraded manually.
PREFECT_API_DATABASE_TIMEOUT = Setting(Optional[float], default=10.0)
module-attribute
¶
A statement timeout, in seconds, applied to all database interactions made by the API. Defaults to 10 seconds.
PREFECT_API_DATABASE_CONNECTION_TIMEOUT = Setting(Optional[float], default=5)
module-attribute
¶
A connection timeout, in seconds, applied to database
connections. Defaults to 5
.
PREFECT_API_SERVICES_SCHEDULER_LOOP_SECONDS = Setting(float, default=60)
module-attribute
¶
The scheduler loop interval, in seconds. This determines
how often the scheduler will attempt to schedule new flow runs, but has no
impact on how quickly either flow runs or task runs are actually executed.
Defaults to 60
.
PREFECT_API_SERVICES_SCHEDULER_DEPLOYMENT_BATCH_SIZE = Setting(int, default=100)
module-attribute
¶
The number of deployments the scheduler will attempt to
schedule in a single batch. If there are more deployments than the batch
size, the scheduler immediately attempts to schedule the next batch; it
does not sleep for scheduler_loop_seconds
until it has visited every
deployment once. Defaults to 100
.
PREFECT_API_SERVICES_SCHEDULER_MAX_RUNS = Setting(int, default=100)
module-attribute
¶
The scheduler will attempt to schedule up to this many
auto-scheduled runs in the future. Note that runs may have fewer than
this many scheduled runs, depending on the value of
scheduler_max_scheduled_time
. Defaults to 100
.
PREFECT_API_SERVICES_SCHEDULER_MIN_RUNS = Setting(int, default=3)
module-attribute
¶
The scheduler will attempt to schedule at least this many
auto-scheduled runs in the future. Note that runs may have more than
this many scheduled runs, depending on the value of
scheduler_min_scheduled_time
. Defaults to 3
.
PREFECT_API_SERVICES_SCHEDULER_MAX_SCHEDULED_TIME = Setting(timedelta, default=timedelta(days=100))
module-attribute
¶
The scheduler will create new runs up to this far in the
future. Note that this setting will take precedence over
scheduler_max_runs
: if a flow runs once a month and
scheduler_max_scheduled_time
is three months, then only three runs will be
scheduled. Defaults to 100 days (8640000
seconds).
PREFECT_API_SERVICES_SCHEDULER_MIN_SCHEDULED_TIME = Setting(timedelta, default=timedelta(hours=1))
module-attribute
¶
The scheduler will create new runs at least this far in the
future. Note that this setting will take precedence over scheduler_min_runs
:
if a flow runs every hour and scheduler_min_scheduled_time
is three hours,
then three runs will be scheduled even if scheduler_min_runs
is 1. Defaults to
1 hour (3600
seconds).
PREFECT_API_SERVICES_SCHEDULER_INSERT_BATCH_SIZE = Setting(int, default=500)
module-attribute
¶
The number of flow runs the scheduler will attempt to insert
in one batch across all deployments. If the number of flow runs to
schedule exceeds this amount, the runs will be inserted in batches of this size.
Defaults to 500
.
PREFECT_API_SERVICES_LATE_RUNS_LOOP_SECONDS = Setting(float, default=5)
module-attribute
¶
The late runs service will look for runs to mark as late
this often. Defaults to 5
.
PREFECT_API_SERVICES_LATE_RUNS_AFTER_SECONDS = Setting(timedelta, default=timedelta(seconds=5))
module-attribute
¶
The late runs service will mark runs as late after they
have exceeded their scheduled start time by this many seconds. Defaults
to 5
seconds.
PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_LOOP_SECONDS = Setting(float, default=5)
module-attribute
¶
The pause expiration service will look for runs to mark as failed
this often. Defaults to 5
.
PREFECT_API_SERVICES_CANCELLATION_CLEANUP_LOOP_SECONDS = Setting(float, default=20)
module-attribute
¶
The cancellation cleanup service will look non-terminal tasks and subflows
this often. Defaults to 20
.
PREFECT_API_DEFAULT_LIMIT = Setting(int, default=200)
module-attribute
¶
The default limit applied to queries that can return
multiple objects, such as POST /flow_runs/filter
.
PREFECT_SERVER_API_HOST = Setting(str, default='127.0.0.1')
module-attribute
¶
The API's host address (defaults to 127.0.0.1
).
PREFECT_SERVER_API_PORT = Setting(int, default=4200)
module-attribute
¶
The API's port address (defaults to 4200
).
PREFECT_SERVER_API_KEEPALIVE_TIMEOUT = Setting(int, default=5)
module-attribute
¶
The API's keep alive timeout (defaults to 5
).
Refer to https://www.uvicorn.org/settings/#timeouts for details.
When the API is hosted behind a load balancer, you may want to set this to a value greater than the load balancer's idle timeout.
Note this setting only applies when calling prefect server start
; if hosting the
API with another tool you will need to configure this there instead.
PREFECT_UI_ENABLED = Setting(bool, default=True)
module-attribute
¶
Whether or not to serve the Prefect UI.
PREFECT_UI_API_URL = Setting(str, default=None, value_callback=default_ui_api_url)
module-attribute
¶
The connection url for communication from the UI to the API.
Defaults to PREFECT_API_URL
if set. Otherwise, the default URL is generated from
PREFECT_SERVER_API_HOST
and PREFECT_SERVER_API_PORT
. If providing a custom value,
the aforementioned settings may be templated into the given string.
PREFECT_SERVER_ANALYTICS_ENABLED = Setting(bool, default=True)
module-attribute
¶
When enabled, Prefect sends anonymous data (e.g. count of flow runs, package version) on server startup to help us improve our product.
PREFECT_API_SERVICES_SCHEDULER_ENABLED = Setting(bool, default=True)
module-attribute
¶
Whether or not to start the scheduling service in the server application. If disabled, you will need to run this service separately to schedule runs for deployments.
PREFECT_API_SERVICES_LATE_RUNS_ENABLED = Setting(bool, default=True)
module-attribute
¶
Whether or not to start the late runs service in the server application. If disabled, you will need to run this service separately to have runs past their scheduled start time marked as late.
PREFECT_API_SERVICES_FLOW_RUN_NOTIFICATIONS_ENABLED = Setting(bool, default=True)
module-attribute
¶
Whether or not to start the flow run notifications service in the server application. If disabled, you will need to run this service separately to send flow run notifications.
PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_ENABLED = Setting(bool, default=True)
module-attribute
¶
Whether or not to start the paused flow run expiration service in the server application. If disabled, paused flows that have timed out will remain in a Paused state until a resume attempt.
PREFECT_API_TASK_CACHE_KEY_MAX_LENGTH = Setting(int, default=2000)
module-attribute
¶
The maximum number of characters allowed for a task run cache key. This setting cannot be changed client-side, it must be set on the server.
PREFECT_API_SERVICES_CANCELLATION_CLEANUP_ENABLED = Setting(bool, default=True)
module-attribute
¶
Whether or not to start the cancellation cleanup service in the server application. If disabled, task runs and subflow runs belonging to cancelled flows may remain in non-terminal states.
PREFECT_EXPERIMENTAL_ENABLE_EVENTS_CLIENT = Setting(bool, default=False)
module-attribute
¶
Whether or not to enable experimental Prefect work pools.
PREFECT_EXPERIMENTAL_WARN_EVENTS_CLIENT = Setting(bool, default=False)
module-attribute
¶
Whether or not to warn when experimental Prefect work pools are used.
PREFECT_EXPERIMENTAL_ENABLE_WORK_POOLS = Setting(bool, default=True)
module-attribute
¶
Whether or not to enable experimental Prefect work pools.
PREFECT_EXPERIMENTAL_WARN_WORK_POOLS = Setting(bool, default=False)
module-attribute
¶
Whether or not to warn when experimental Prefect work pools are used.
PREFECT_EXPERIMENTAL_ENABLE_WORKERS = Setting(bool, default=False)
module-attribute
¶
Whether or not to enable experimental Prefect workers.
PREFECT_EXPERIMENTAL_WARN_WORKERS = Setting(bool, default=True)
module-attribute
¶
Whether or not to warn when experimental Prefect workers are used.
PREFECT_WORKER_HEARTBEAT_SECONDS = Setting(float, default=30)
module-attribute
¶
Number of seconds a worker should wait between sending a heartbeat.
PREFECT_WORKER_QUERY_SECONDS = Setting(float, default=10)
module-attribute
¶
Number of seconds a worker should wait between queries for scheduled flow runs.
PREFECT_WORKER_PREFETCH_SECONDS = Setting(float, default=10)
module-attribute
¶
The number of seconds into the future a worker should query for scheduled flow runs. Can be used to compensate for infrastructure start up time for a worker.
PREFECT_WORKER_WORKFLOW_STORAGE_SCAN_SECONDS = Setting(float, default=30)
module-attribute
¶
The number of seconds a worker should wait between scanning its workflow storage location for submitted deployments.
PREFECT_WORKER_WORKFLOW_STORAGE_PATH = Setting(Path, default=Path('${PREFECT_HOME}') / 'workflows', value_callback=template_with_settings(PREFECT_HOME))
module-attribute
¶
The location where workers will scan for newly submitted deployments and store flow code for submitted deployments.
PREFECT_EXPERIMENTAL_ENABLE_ARTIFACTS = Setting(bool, default=False)
module-attribute
¶
Whether or not to enable experimental Prefect artifacts.
PREFECT_LOGGING_ORION_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_LOGGING_TO_API_ENABLED` instead.', deprecated_renamed_to=PREFECT_LOGGING_TO_API_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_LOGGING_TO_API_ENABLED instead.
PREFECT_LOGGING_ORION_BATCH_INTERVAL = Setting(Optional[float], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_LOGGING_TO_API_BATCH_INTERVAL` instead.', deprecated_renamed_to=PREFECT_LOGGING_TO_API_BATCH_INTERVAL)
module-attribute
¶
Deprecated. Use PREFECT_LOGGING_TO_API_BATCH_INTERVAL instead.
PREFECT_LOGGING_ORION_BATCH_SIZE = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_LOGGING_TO_API_BATCH_SIZE` instead.', deprecated_renamed_to=PREFECT_LOGGING_TO_API_BATCH_SIZE)
module-attribute
¶
Deprecated. Use PREFECT_LOGGING_TO_API_BATCH_SIZE instead.
PREFECT_LOGGING_ORION_MAX_LOG_SIZE = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_LOGGING_TO_API_MAX_LOG_SIZE` instead.', deprecated_renamed_to=PREFECT_LOGGING_TO_API_MAX_LOG_SIZE)
module-attribute
¶
Deprecated. Use PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW instead.
PREFECT_LOGGING_ORION_WHEN_MISSING_FLOW = Setting(Optional[Literal['warn', 'error', 'ignore']], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW` instead.', deprecated_renamed_to=PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW)
module-attribute
¶
Deprecated. Use PREFECT_LOGGING_TO_API_WHEN_MISSING_FLOW instead.
PREFECT_ORION_BLOCKS_REGISTER_ON_START = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_BLOCKS_REGISTER_ON_START` instead.', deprecated_renamed_to=PREFECT_API_BLOCKS_REGISTER_ON_START)
module-attribute
¶
Deprecated. Use PREFECT_API_BLOCKS_REGISTER_ON_START
instead.
PREFECT_ORION_DATABASE_PASSWORD = Setting(Optional[str], default=None, is_secret=True, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_DATABASE_PASSWORD` instead.', deprecated_renamed_to=PREFECT_API_DATABASE_PASSWORD)
module-attribute
¶
Deprecated. Use PREFECT_API_DATABASE_PASSWORD
instead.
PREFECT_ORION_DATABASE_CONNECTION_URL = Setting(Optional[str], default=None, value_callback=template_with_settings(PREFECT_HOME, PREFECT_API_DATABASE_PASSWORD), is_secret=True, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_DATABASE_CONNECTION_URL` instead.', deprecated_renamed_to=PREFECT_API_DATABASE_CONNECTION_URL)
module-attribute
¶
Deprecated. Use PREFECT_API_DATABASE_CONNECTION_URL
instead.
PREFECT_ORION_DATABASE_ECHO = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_DATABASE_ECHO` instead.', deprecated_renamed_to=PREFECT_API_DATABASE_ECHO)
module-attribute
¶
Deprecated. Use PREFECT_API_DATABASE_ECHO
instead.
PREFECT_ORION_DATABASE_MIGRATE_ON_START = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_DATABASE_MIGRATE_ON_START` instead.', deprecated_renamed_to=PREFECT_API_DATABASE_MIGRATE_ON_START)
module-attribute
¶
Deprecated. Use PREFECT_API_DATABASE_MIGRATE_ON_START
instead.
PREFECT_ORION_DATABASE_TIMEOUT = Setting(Optional[float], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_DATABASE_TIMEOUT` instead.', deprecated_renamed_to=PREFECT_API_DATABASE_TIMEOUT)
module-attribute
¶
Deprecated. Use PREFECT_API_DATABASE_TIMEOUT
instead.
PREFECT_ORION_DATABASE_CONNECTION_TIMEOUT = Setting(Optional[float], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_DATABASE_CONNECTION_TIMEOUT` instead.', deprecated_renamed_to=PREFECT_API_DATABASE_CONNECTION_TIMEOUT)
module-attribute
¶
Deprecated. Use PREFECT_API_DATABASE_CONNECTION_TIMEOUT
instead.
PREFECT_ORION_SERVICES_SCHEDULER_LOOP_SECONDS = Setting(Optional[float], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_LOOP_SECONDS` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_LOOP_SECONDS)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_LOOP_SECONDS
instead.
PREFECT_ORION_SERVICES_SCHEDULER_DEPLOYMENT_BATCH_SIZE = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_DEPLOYMENT_BATCH_SIZE` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_DEPLOYMENT_BATCH_SIZE)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_DEPLOYMENT_BATCH_SIZE
instead.
PREFECT_ORION_SERVICES_SCHEDULER_MAX_RUNS = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_MAX_RUNS` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_MAX_RUNS)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_MAX_RUNS
instead.
PREFECT_ORION_SERVICES_SCHEDULER_MIN_RUNS = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_MIN_RUNS` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_MIN_RUNS)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_MIN_RUNS
instead.
PREFECT_ORION_SERVICES_SCHEDULER_MAX_SCHEDULED_TIME = Setting(Optional[timedelta], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_MAX_SCHEDULED_TIME` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_MAX_SCHEDULED_TIME)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_MAX_SCHEDULED_TIME
instead.
PREFECT_ORION_SERVICES_SCHEDULER_MIN_SCHEDULED_TIME = Setting(Optional[timedelta], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_MIN_SCHEDULED_TIME` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_MIN_SCHEDULED_TIME)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_MIN_SCHEDULED_TIME
instead.
PREFECT_ORION_SERVICES_SCHEDULER_INSERT_BATCH_SIZE = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_INSERT_BATCH_SIZE` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_INSERT_BATCH_SIZE)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_INSERT_BATCH_SIZE
instead.
PREFECT_ORION_SERVICES_LATE_RUNS_LOOP_SECONDS = Setting(Optional[float], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_LATE_RUNS_LOOP_SECONDS` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_LATE_RUNS_LOOP_SECONDS)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_LATE_RUNS_LOOP_SECONDS
instead.
PREFECT_ORION_SERVICES_LATE_RUNS_AFTER_SECONDS = Setting(Optional[timedelta], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_LATE_RUNS_AFTER_SECONDS` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_LATE_RUNS_AFTER_SECONDS)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_LATE_RUNS_AFTER_SECONDS
instead.
PREFECT_ORION_SERVICES_PAUSE_EXPIRATIONS_LOOP_SECONDS = Setting(Optional[float], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_LOOP_SECONDS` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_LOOP_SECONDS)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_LOOP_SECONDS
instead.
PREFECT_ORION_SERVICES_CANCELLATION_CLEANUP_LOOP_SECONDS = Setting(Optional[float], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_CANCELLATION_CLEANUP_LOOP_SECONDS` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_CANCELLATION_CLEANUP_LOOP_SECONDS)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_CANCELLATION_CLEANUP_LOOP_SECONDS
instead.
PREFECT_ORION_API_DEFAULT_LIMIT = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_DEFAULT_LIMIT` instead.', deprecated_renamed_to=PREFECT_API_DEFAULT_LIMIT)
module-attribute
¶
Deprecated. Use PREFECT_API_DEFAULT_LIMIT
instead.
PREFECT_ORION_API_HOST = Setting(Optional[str], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_SERVER_API_HOST` instead.', deprecated_renamed_to=PREFECT_SERVER_API_HOST)
module-attribute
¶
Deprecated. Use PREFECT_SERVER_API_HOST
instead.
PREFECT_ORION_API_PORT = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_SERVER_API_PORT` instead.', deprecated_renamed_to=PREFECT_SERVER_API_PORT)
module-attribute
¶
Deprecated. Use PREFECT_SERVER_API_PORT
instead.
PREFECT_ORION_API_KEEPALIVE_TIMEOUT = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_SERVER_API_KEEPALIVE_TIMEOUT` instead.', deprecated_renamed_to=PREFECT_SERVER_API_KEEPALIVE_TIMEOUT)
module-attribute
¶
Deprecated. Use PREFECT_SERVER_API_KEEPALIVE_TIMEOUT
instead.
PREFECT_ORION_UI_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_UI_ENABLED` instead.', deprecated_renamed_to=PREFECT_UI_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_UI_ENABLED
instead.
PREFECT_ORION_UI_API_URL = Setting(Optional[str], default=None, value_callback=default_ui_api_url, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_UI_API_URL` instead.', deprecated_renamed_to=PREFECT_UI_API_URL)
module-attribute
¶
Deprecated. Use PREFECT_UI_API_URL
instead.
PREFECT_ORION_ANALYTICS_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_SERVER_ANALYTICS_ENABLED` instead.', deprecated_renamed_to=PREFECT_SERVER_ANALYTICS_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_SERVER_ANALYTICS_ENABLED
instead.
PREFECT_ORION_SERVICES_SCHEDULER_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_SCHEDULER_ENABLED` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_SCHEDULER_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_SCHEDULER_ENABLED
instead.
PREFECT_ORION_SERVICES_LATE_RUNS_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_LATE_RUNS_ENABLED` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_LATE_RUNS_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_LATE_RUNS_ENABLED
instead.
PREFECT_ORION_SERVICES_FLOW_RUN_NOTIFICATIONS_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_FLOW_RUN_NOTIFICATIONS_ENABLED` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_FLOW_RUN_NOTIFICATIONS_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_FLOW_RUN_NOTIFICATIONS_ENABLED
instead.
PREFECT_ORION_SERVICES_PAUSE_EXPIRATIONS_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_ENABLED` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_PAUSE_EXPIRATIONS_ENABLED
instead.
PREFECT_ORION_TASK_CACHE_KEY_MAX_LENGTH = Setting(Optional[int], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_TASK_CACHE_KEY_MAX_LENGTH` instead.', deprecated_renamed_to=PREFECT_API_TASK_CACHE_KEY_MAX_LENGTH)
module-attribute
¶
Deprecated. Use PREFECT_API_TASK_CACHE_KEY_MAX_LENGTH
instead.
PREFECT_ORION_SERVICES_CANCELLATION_CLEANUP_ENABLED = Setting(Optional[bool], default=None, deprecated=True, deprecated_start_date='Feb 2023', deprecated_help='Use `PREFECT_API_SERVICES_CANCELLATION_CLEANUP_ENABLED` instead.', deprecated_renamed_to=PREFECT_API_SERVICES_CANCELLATION_CLEANUP_ENABLED)
module-attribute
¶
Deprecated. Use PREFECT_API_SERVICES_CANCELLATION_CLEANUP_ENABLED
instead.
Setting
¶
Bases: Generic[T]
Setting definition type.
Source code in prefect/settings.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
value
¶
Get the current value of a setting.
Example:
from prefect.settings import PREFECT_API_URL
PREFECT_API_URL.value()
Source code in prefect/settings.py
131 132 133 134 135 136 137 138 139 140 141 |
|
value_from
¶
Get the value of a setting from a settings object
Example:
from prefect.settings import get_default_settings
PREFECT_API_URL.value_from(get_default_settings())
Source code in prefect/settings.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
|
Settings
¶
Bases: SettingsFieldsMixin
Contains validated Prefect settings.
Settings should be accessed using the relevant Setting
object. For example:
from prefect.settings import PREFECT_HOME
PREFECT_HOME.value()
Accessing a setting attribute directly will ignore any value_callback
mutations.
This is not recommended:
from prefect.settings import Settings
Settings().PREFECT_PROFILES_PATH # PosixPath('${PREFECT_HOME}/profiles.toml')
Source code in prefect/settings.py
1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 |
|
value_of
¶
Retrieve a setting's value.
Source code in prefect/settings.py
1639 1640 1641 1642 1643 1644 1645 1646 |
|
post_root_validators
¶
Add root validation functions for settings here.
Source code in prefect/settings.py
1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 |
|
with_obfuscated_secrets
¶
Returns a copy of this settings object with secret setting values obfuscated.
Source code in prefect/settings.py
1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 |
|
to_environment_variables
¶
Convert the settings object to environment variables.
Note that setting values will not be run through their value_callback
allowing
dynamic resolution to occur when loaded from the returned environment.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include_keys |
An iterable of settings to include in the return value. If not set, all settings are used. |
required | |
exclude_unset |
bool
|
Only include settings that have been set (i.e. the value is
not from the default). If set, unset keys will be dropped even if they
are set in |
False
|
Returns:
Type | Description |
---|---|
Dict[str, str]
|
A dictionary of settings with values cast to strings |
Source code in prefect/settings.py
1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 |
|
Profile
¶
Bases: pydantic.BaseModel
A user profile containing settings.
Source code in prefect/settings.py
1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 |
|
validate_settings
¶
Validate the settings contained in this profile.
Raises:
Type | Description |
---|---|
pydantic.ValidationError
|
When settings do not have valid values. |
Source code in prefect/settings.py
1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 |
|
convert_deprecated_renamed_settings
¶
Update settings in place to replace deprecated settings with new settings when renamed.
Returns a list of tuples with the old and new setting.
Source code in prefect/settings.py
1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 |
|
ProfilesCollection
¶
" A utility class for working with a collection of profiles.
Profiles in the collection must have unique names.
The collection may store the name of the active profile.
Source code in prefect/settings.py
1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 |
|
names: Set[str]
property
¶
Return a set of profile names in this collection.
active_profile: Optional[Profile]
property
¶
Retrieve the active profile in this collection.
set_active
¶
Set the active profile name in the collection.
A null value may be passed to indicate that this collection does not determine the active profile.
Source code in prefect/settings.py
1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 |
|
update_profile
¶
Add a profile to the collection or update the existing on if the name is already present in this collection.
If updating an existing profile, the settings will be merged. Settings can
be dropped from the existing profile by setting them to None
in the new
profile.
Returns the new profile object.
Source code in prefect/settings.py
1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 |
|
add_profile
¶
Add a profile to the collection.
If the profile name already exists, an exception will be raised.
Source code in prefect/settings.py
2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 |
|
remove_profile
¶
Remove a profile from the collection.
Source code in prefect/settings.py
2025 2026 2027 2028 2029 |
|
without_profile_source
¶
Remove profiles that were loaded from a given path.
Returns a new collection.
Source code in prefect/settings.py
2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 |
|
get_extra_loggers
¶
value_callback
for PREFECT_LOGGING_EXTRA_LOGGERS
that parses the CSV string into a
list and trims whitespace from logger names.
Source code in prefect/settings.py
230 231 232 233 234 235 |
|
debug_mode_log_level
¶
value_callback
for PREFECT_LOGGING_LEVEL
that overrides the log level to DEBUG
when debug mode is enabled.
Source code in prefect/settings.py
242 243 244 245 246 247 248 249 250 |
|
only_return_value_in_test_mode
¶
value_callback
for PREFECT_TEST_SETTING
that only allows access during test mode
Source code in prefect/settings.py
253 254 255 256 257 258 259 260 |
|
default_ui_api_url
¶
value_callback
for PREFECT_UI_API_URL
that sets the default value to
PREFECT_API_URL
if set otherwise it constructs an API URL from the API settings.
Source code in prefect/settings.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
template_with_settings
¶
Returns a value_callback
that will template the given settings into the runtime
value for the setting.
Source code in prefect/settings.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 |
|
max_log_size_smaller_than_batch_size
¶
Validator for settings asserting the batch size and match log size are compatible
Source code in prefect/settings.py
300 301 302 303 304 305 306 307 308 309 310 311 312 |
|
warn_on_database_password_value_without_usage
¶
Validator for settings warning if the database password is set but not used.
Source code in prefect/settings.py
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
get_current_settings
¶
Returns a settings object populated with values from the current settings context or, if no settings context is active, the environment.
Source code in prefect/settings.py
1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 |
|
get_settings_from_env
¶
Returns a settings object populated with default values and overrides from environment variables, ignoring any values in profiles.
Calls with the same environment return a cached object instead of reconstructing to avoid validation overhead.
Source code in prefect/settings.py
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 |
|
get_default_settings
¶
Returns a settings object populated with default values, ignoring any overrides from environment variables or profiles.
This is cached since the defaults should not change during the lifetime of the module.
Source code in prefect/settings.py
1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 |
|
temporary_settings
¶
Temporarily override the current settings by entering a new profile.
See Settings.copy_with_update
for details on different argument behavior.
Example
from prefect.settings import PREFECT_API_URL
with temporary_settings(updates={PREFECT_API_URL: "foo"}): assert PREFECT_API_URL.value() == "foo"
with temporary_settings(set_defaults={PREFECT_API_URL: "bar"}): assert PREFECT_API_URL.value() == "foo"
with temporary_settings(restore_defaults={PREFECT_API_URL}): assert PREFECT_API_URL.value() is None
with temporary_settings(set_defaults={PREFECT_API_URL: "bar"}) assert PREFECT_API_URL.value() == "bar"
assert PREFECT_API_URL.value() is None
Source code in prefect/settings.py
1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 |
|
load_profiles
¶
Load all profiles from the default and current profile paths.
Source code in prefect/settings.py
2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 |
|
load_current_profile
¶
Load the current profile from the default and current profile paths.
This will not include settings from the current settings context. Only settings that have been persisted to the profiles file will be saved.
Source code in prefect/settings.py
2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 |
|
save_profiles
¶
Writes all non-default profiles to the current profiles path.
Source code in prefect/settings.py
2160 2161 2162 2163 2164 2165 2166 |
|
load_profile
¶
Load a single profile by name.
Source code in prefect/settings.py
2169 2170 2171 2172 2173 2174 2175 2176 2177 |
|
update_current_profile
¶
Update the persisted data for the profile currently in-use.
If the profile does not exist in the profiles file, it will be created.
Given settings will be merged with the existing settings as described in
ProfilesCollection.update_profile
.
Returns:
Type | Description |
---|---|
Profile
|
The new profile. |
Source code in prefect/settings.py
2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 |
|