ripe-alarm-8919
12/20/2024, 1:11 AMMETAFLOW_RUNTIME_ENVIRONMENT
is set to kubernetes
correctly in my k8s pod when I start my flow with --with kubernetes
but METAFLOW_RUNTIME_NAME
doesn’t.
Can I rely on the METAFLOW_RUNTIME_ENVIRONMENT to tell me which env I’m in?ancient-application-36103
12/20/2024, 2:30 AMripe-alarm-8919
12/20/2024, 9:39 PMFlowDecorator
that calls subprocess.run(
to run poetry, kubectl etc..
What I observed is that the flow_init
logic is executed in both scenarios:
1. when I submit the job locally as in poetry run python ./flow.py --environment=pypi run --with kubernetes
. (it would have access to kubectl, poetry etc. tools install locally)
2. when metaflow sets up the pod in k8s. (it won’t have access to kubectl, poetry etc)
So in my custom decorator, I need to skip these logic if it’s running on remotely. Thus I need something like:
if RUNTIME_ENVIRONMENT == "local":
do_some_local_validation() # access poetry, kubectl etc.
ripe-alarm-8919
12/20/2024, 9:42 PM@poetry
flow decorator that copies our poetry’s project dependency (usually defined as in project root pyproject.toml
and its lock file) into the metaflow @pypi
decorator for 3rd party dependencies.ancient-application-36103
12/20/2024, 9:48 PMripe-alarm-8919
12/20/2024, 10:30 PM