Repository navigation
Replies: 1 comment
|
This is a real settings-loading inconsistency, and I think it is worth fixing because the CLI reports the Your diagnosis matches the current code paths:
The immediate workaround is to materialize the bundled profiles before selecting one: prefect profile populate-defaults
prefect profile use localAlternatively, after selecting prefect config set PREFECT_API_URL=http://127.0.0.1:4200/apiFor a source fix, A focused regression test can use a clean Relevant implementation: |
Uh oh!
There was an error while loading. Please reload this page.
Hi!
I am new to Prefect and want to check how it works. I cloned the repository and started a local server with
prefect server startin one console session. The bundledlocalprofile points athttp://127.0.0.1:4200/api, so in another session I ranprefect profile use localto connect my flow to that server.prefect config viewconfirmed it:PREFECT_API_URL='http://127.0.0.1:4200/api' (from profile). But when I ran my flow script, it did not use that server - it silently started its own temporaryephemeralone. So thelocalprofile is shown byconfig viewbut not applied at runtime. It might not be a bug, but it looks inconsistent!Note: I did not run
prefect profile populate-defaults, soprefect profile use localwrote onlyactive = "local"with an empty[profiles]table - thelocalprofile itself was never copied into~/.prefect/profiles.toml.With further investigation I found that if bundled profile (https://github.com/PrefectHQ/prefect/blob/60025750fb7ea1d69fef8a1c8b1e013cdc8149ae/src/prefect/settings/profiles.toml) is not copied into ~/.prefect/profiles.toml using
populate-defaultsit still can be shown through config view, but script execution does not merge it into settings and silently starts a temporary ephemeral server.the script doesn't find local, and substitutes ephemeral - it never resolves the selected local by name.
The possible cause is in the
ProfileSettingsTomlLoader._load_profile_settings(prefect/src/prefect/settings/sources.py
Lines 163 to 164 in 6002575
~/.prefect/profiles.toml, falls back to_get_default_profile()(the template's ephemeral) instead of resolving the selected name against the bundled template.As a summary: both read the bundled
profiles.toml, butprefect config viewresolves the selected profile (local) against it, whileProfileSettingsTomlLoader._load_profile_settingsonly falls back to the template's default (ephemeral) — it never resolves the selected name.Not sure if this case is worth fixing. A similar case for the
ephemeralprofile was reported in #16118 / #16101 and fixed in #16119 - but that fix only covers the template's default profile; the same situation withlocalremains unhandled. It comes as a surprise for people who start using Prefect for development from a clean checkout. For production installations, environment variables (or.env/prefect.toml) take precedence over profiles, so the inconsistency is visible only in a clean dev environment.All reactions