prefect.settings.context
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 src/prefect/settings/context.py
10 11 12 13 14 15 16 17 18 19 20 21 |
|
temporary_settings(updates=None, set_defaults=None, restore_defaults=None)
Temporarily override the current settings by entering a new profile.
See Settings.copy_with_update
for details on different argument behavior.
Examples:
>>> 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 src/prefect/settings/context.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|