rhythmic-beach-70913
02/28/2024, 2:30 PMdry-beach-38304
02/28/2024, 3:28 PMrhythmic-beach-70913
02/28/2024, 3:33 PMdry-beach-38304
02/28/2024, 3:35 PMrhythmic-beach-70913
02/28/2024, 3:35 PMdry-beach-38304
02/28/2024, 3:36 PMdry-beach-38304
02/28/2024, 3:37 PMrhythmic-beach-70913
02/28/2024, 3:44 PMDATASTORE_SYSROOT_S3 = from_aws("DATASTORE_SYSROOT_S3")
This has worked until now and avoids the need for lots of config/env vars and allows us to easily switch between dev/test etc by just setting one env var
The problem I'm hitting is that when netflix_ext is trying to set CONDA_S3ROOT from DATASTORE_SYSROOT_S3 and DATASTORE_SYSROOT_S3 hasn't been set yet because our module config hasn't run yet
it then exits so no opportunity to set later (although ideally wouldn't really want that - had a similar problem with SERVICE_HEADERS and SERVICE_AUTH_KEY having to replicate the logic from the default)rhythmic-beach-70913
02/28/2024, 4:08 PMdry-beach-38304
02/28/2024, 4:24 PMdry-beach-38304
02/28/2024, 4:25 PMrhythmic-beach-70913
02/28/2024, 4:36 PMdef from_aws(param, default_value=None):
"""
First try to pull value from environment, then from metaflow config JSON, then aws ssm
"""
from botocore.exceptions import ClientError
if MF_PROFILE is None or MF_PROFILE == "None":
return from_conf(param, default_value)
def_value = default_value
lookup = param.replace("_", "-")
p_name = f"/metaflow-service/{MF_PROFILE}/METAFLOW-{lookup}"
try:
p_value = ssm.get_parameter(Name=p_name, WithDecryption=True)
def_value = p_value["Parameter"]["Value"]
except ClientError as pnf:
raise MetaflowException(f"Failed to find {p_name}: {pnf.response['Error']}")
return from_conf(param, def_value)dry-beach-38304
02/28/2024, 5:01 PMCONDA_S3ROOT = from_aws("CONDA_S3ROOT", os.path.join(DATASTORE_SYSROOT_S3, "conda_env") if DATASTORE_SYSROOT_S3 else None)
or something to that nature. This will “reset” the value to what you want it to be and I think that should work.
The ordering question is a bit of a tough one. Determinining “dependent” configs is not easy. Our fairly limited use case was that we wanted to override configurations from the basic metaflow and potentially from previously loaded modules but this use case (totally valid) was not something I had thought about.rhythmic-beach-70913
02/28/2024, 5:04 PMdry-beach-38304
02/28/2024, 5:08 PMdry-beach-38304
02/28/2024, 5:08 PMrhythmic-beach-70913
02/28/2024, 5:12 PM