Charles Leung
08/18/2021, 4:44 PM# Registration Configs
flow.run_config = NomadRun(**prefect.config.run_config)
flow.storage = GitLab(path='flow.py', **prefect.config.storage)
Kevin Kho
Kevin Kho
Charles Leung
08/18/2021, 5:21 PMCharles Leung
08/18/2021, 5:22 PMCharles Leung
08/18/2021, 5:23 PMCharles Leung
08/18/2021, 5:25 PMKevin Kho
import prefect…
is the one that instantiates the config and it’s only loaded once.Kevin Kho
prefect.config
isn’t loading it, are you referring to the contents of the file or the env variable itself? Because I’m expecting the env variable to be respected, but for the file to not be presentCharles Leung
08/18/2021, 5:37 PMKevin Kho
Charles Leung
08/18/2021, 6:32 PMCharles Leung
08/18/2021, 6:55 PMif 'vault_url' not in prefect.config.keys():
import re
print('Env:\n')
print(os.getenv('PREFECT__USER_CONFIG_PATH'))
print('\nConfig:\n')
print(prefect.config)
print('\nFile:\n')
print(open(os.getenv('PREFECT__USER_CONFIG_PATH')).read())
# load prefect configuration
DEFAULT_CONFIG = os.path.join(os.path.dirname(prefect.configuration.__file__), "config.toml")
USER_CONFIG = os.getenv("PREFECT__USER_CONFIG_PATH", "~/.prefect/config.toml")
BACKEND_CONFIG = os.getenv("PREFECT__BACKEND_CONFIG_PATH", "~/.prefect/backend.toml")
ENV_VAR_PREFIX = "PREFECT"
INTERPOLATION_REGEX = re.compile(r"\${(.[^${}]*)}")
config = prefect.configuration.load_configuration(
path=DEFAULT_CONFIG,
user_config_path=USER_CONFIG,
backend_config_path=BACKEND_CONFIG,
env_var_prefix=ENV_VAR_PREFIX,
)
config = prefect.configuration.process_task_defaults(config)
print('\nReloaded:\n')
print(config)
prefect.config = config
Charles Leung
08/18/2021, 6:56 PMKevin Kho
Charles Leung
08/18/2021, 8:59 PM