Jonathan Mathews
08/12/2022, 12:14 PMAnna Geller
08/12/2022, 1:58 PMJonathan Mathews
08/12/2022, 2:08 PMAnna Geller
08/12/2022, 2:18 PMJonathan Mathews
08/12/2022, 2:20 PMAnna Geller
08/12/2022, 2:48 PMJonathan Mathews
08/12/2022, 3:37 PMdef set_run_config(local: bool = False) -> RunConfig:
if local:
return LocalRun(labels=["dev"])
aws_account_id = Secret("AWS_ACCOUNT_ID").get()
return KubernetesRun(
labels=["prod"],
image=f"{aws_account_id}.<http://dkr.ecr.us-east-1.amazonaws.com/prefect-dbt-k8s-snowflake:latest|dkr.ecr.us-east-1.amazonaws.com/prefect-dbt-k8s-snowflake:latest>",
image_pull_policy="IfNotPresent",
)
if local
line and then it falls back to KubernetesRun
. Not sure how I’d add another one there?Anna Geller
08/12/2022, 5:35 PMdef set_run_config(env: str = "local") -> RunConfig:
if env == "local":
return LocalRun(labels=["dev"])
elif env == "staging":
return DockerRun(labels=["staging"])
aws_account_id = Secret("AWS_ACCOUNT_ID").get()
return KubernetesRun(
labels=["prod"],
image=f"{aws_account_id}.<http://dkr.ecr.us-east-1.amazonaws.com/prefect-dbt-k8s-snowflake:latest|dkr.ecr.us-east-1.amazonaws.com/prefect-dbt-k8s-snowflake:latest>",
image_pull_policy="IfNotPresent",
)
Jonathan Mathews
08/13/2022, 6:40 AMenv
?
Or how will env
be different in each environment?Anna Geller
08/13/2022, 11:45 AMJonathan Mathews
08/15/2022, 1:09 PMwith Flow(FLOW_NAME, storage=set_storage(FLOW_NAME), run_config=set_run_config(env="test"),) as flow:
env = os.getenv('ENV_SWITCH')
with Flow(FLOW_NAME, storage=set_storage(FLOW_NAME), run_config=set_run_config(env="test"),) as flow:
Anna Geller
08/15/2022, 2:08 PMJonathan Mathews
08/15/2022, 2:39 PM