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

schedulers/docker: Add support for setting environment variables #855

Merged
merged 4 commits into from
Mar 27, 2024

Conversation

asuta274
Copy link
Contributor

@asuta274 asuta274 commented Mar 23, 2024

This change adds support for Dict[str, str] type in runopts and use it to expose env flag in DockerScheduler.
The use-case is for setting environment variables for local_docker scheduler in order to access some remote resources.

Test plan:

pytest torchx/schedulers/test/docker_scheduler_test.py
pytest torchx/specs/test/api_test.py
pytest torchx/runner/test/config_test.py

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 23, 2024
Copy link
Contributor

@d4l3k d4l3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with some small comments

There's some pyre and lint errors -- do you mind fixing them? Thanks

"d_none",
type_=Dict[str, str],
default=None,
help="a None dict option",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a test that use these opts below to verify parsing is correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

"env",
type_=Dict[str, str],
default=None,
help="environment varibles to be passed to the run (e.g. ENV1:v1,ENV2:v2,ENV3:v3)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we document that either , or ; will work?

nit: spelling variables

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may also be good to document that this will apply on top of the copied envs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@asuta274
Copy link
Contributor Author

LGTM with some small comments

There's some pyre and lint errors -- do you mind fixing them? Thanks

Done!

@d4l3k d4l3k merged commit e9a6957 into pytorch:main Mar 27, 2024
21 checks passed
@asuta274 asuta274 deleted the viet/local_docker_env_opts branch March 29, 2024 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants