Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with environment variables in modelstep #82

Closed
RasmusToivanen opened this issue Sep 1, 2020 · 4 comments
Closed

Problem with environment variables in modelstep #82

RasmusToivanen opened this issue Sep 1, 2020 · 4 comments

Comments

@RasmusToivanen
Copy link

RasmusToivanen commented Sep 1, 2020

Hi,
Please help.
I am having some challenges with stepfunctions + sagemaker APIs.
It seems that I should be able to pass environmental variables to endpoint using env(dict[str,str]) in the sagemaker.Model constructor in the steps.Modelstep.
However I am not able to get those env variables visible in the endpoint.
I am able to get the env variables working with boto3 but I don't want to use that as I prefer Sagemaker API with step functions.

So how to pass env variables correctly to stepfunctions to that those are visible?

Running:
stepfunctions=1.0.0.9
sagemaker=1.55.4

image
However in container once I start it (printing os.environ all keys and values)
image

@RasmusToivanen
Copy link
Author

With boto3 I can pass values in the same way:
Definition:
image
Same container printing os.environ
image

@t6nn
Copy link

t6nn commented Sep 4, 2020

Looking at the source for ModelStep, it seems that the supplied environment is currently ignored.

Not sure what the effort / consequences to fix this would be, but perhaps a temporary workaround could be to implement your own ModelStep class with environment support or to update the environment directly in the State? For example, something in this direction (haven't tried it myself):
dev_model_step.fields['parameters']['PrimaryContainer']['Environment'] = { ... your environment here ...}

@RasmusToivanen
Copy link
Author

Thans really much @t6nn,
I will try your recommended approaches and will come back to you once I see whether I get those working.

@ca-nguyen
Copy link
Contributor

ca-nguyen commented Sep 11, 2021

Thank you for reporting this bug!
The fix (#160) will be included in the next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants