Hi, I am trying to access env vars inside the flow...
# ask-metaflow
f
Hi, I am trying to access env vars inside the flow steps that I set using an ENTRYPOINT script when I build the docker image which runs on k8s. But it seems they aren't available. On the other hand if I run the docker container locally I do see them. Is this expected? What's the workaround?
Copy code
ENTRYPOINT [ "/opt/setup_env.sh" ]
1
a
it's best to not define
ENTRYPOINT
or
CMD
in your docker container since there interaction needs to be carefully choreographed. You can use
@environment
decorator to specify env vars.
f
These are dynamic env vars which depend on what base docker image we are using. I suppose we can hardcode it but it makes it bit buggy then
a
if you do
METAFLOW_KUBERNETES_SANDBOX_INIT_SCRIPT=/opt/setup_env.sh python flow.py run --with kubernetes
, that should do the trick
f
I am using argo workflow and currently manually trigger it using. How would I pass in this case?
Copy code
python flow.py argo-workflows trigger
a
METAFLOW_KUBERNETES_SANDBOX_INIT_SCRIPT=/opt/setup_env.sh python flow.py argo-workflows create
would deploy the flow on argo workflows
f
Ah thank you!
a
and then you can do
METAFLOW_KUBERNETES_SANDBOX_INIT_SCRIPT=/opt/setup_env.sh python flow.py argo-workflows trigger
to execute it
f
So I have to use it in both case? create and trigger?
a
only in the case of create