KEMBAR78
config: Add env_name_default and env_name_force to Config by c00w · Pull Request #138956 · pytorch/pytorch · GitHub
Skip to content

Conversation

@c00w
Copy link
Contributor

@c00w c00w commented Oct 25, 2024

Stack from ghstack (oldest at bottom):

This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.

[ghstack-poisoned]
@pytorch-bot
Copy link

pytorch-bot bot commented Oct 25, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/138956

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 2ed5022 with merge base 5e4c8b6 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

c00w added a commit that referenced this pull request Oct 25, 2024
This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.

ghstack-source-id: 75c4906
Pull Request resolved: #138956
[ghstack-poisoned]
c00w added a commit that referenced this pull request Oct 25, 2024
This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.

ghstack-source-id: 6011258
Pull Request resolved: #138956
[ghstack-poisoned]
c00w added a commit that referenced this pull request Oct 29, 2024
This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.

ghstack-source-id: c0a6d9a
Pull Request resolved: #138956
[ghstack-poisoned]
c00w added a commit that referenced this pull request Oct 29, 2024
This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.

ghstack-source-id: c7881c9
Pull Request resolved: #138956
[ghstack-poisoned]
[ghstack-poisoned]
e_jk_false = Config(justknob="does_not_exist", default=False)
e_env_default = Config(env_name_default="ENV_TRUE", default=False)
e_env_default_FALSE = Config(env_name_default="ENV_FALSE", default=True)
e_env_force = Config(env_name_force="ENV_TRUE", default=False)
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 not name these something longer so there is no possibility of conflict lol

@ezyang
Copy link
Contributor

ezyang commented Oct 31, 2024

This is probably fine but the envvar parsing is technically BC breaking

c00w added 3 commits October 31, 2024 16:11
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
@c00w c00w requested a review from ezyang October 31, 2024 22:21
[ghstack-poisoned]
user_override: Any = _UNSET_SENTINEL
# The justknob to check for this config
justknob: Optional[str] = None
# environment variables are read at install time
Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, this is a problem for future us, but handling TRITON_CACHE_DIR is going to be irritating because it is NOT read at install time and we regularly change the environ to make changes. It's better for the code we write to be patching envvar, but it may be more BC to continually read out of envvar.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

I'm going to approve this, but I'd feel much more comfortable if we're actually hooking this up to some config option, that will tell me if we /actually/ got the semantics right.

@c00w
Copy link
Contributor Author

c00w commented Nov 6, 2024

PLan is to stack a PR mograting some config options over (also need to chat with people who added the config options).

@c00w
Copy link
Contributor Author

c00w commented Nov 6, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 6, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

pytorchmergebot pushed a commit that referenced this pull request Nov 7, 2024
This never ended up getting used, and instead we're doing this
resolution within the configuration system.

Removing these unused internal features.
Pull Request resolved: #138767
Approved by: https://github.com/ezyang
ghstack dependencies: #138766, #138956
zero000064 pushed a commit to zero000064/pytorch that referenced this pull request Nov 14, 2024
…8956)

This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.
Pull Request resolved: pytorch#138956
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766
zero000064 pushed a commit to zero000064/pytorch that referenced this pull request Nov 14, 2024
This never ended up getting used, and instead we're doing this
resolution within the configuration system.

Removing these unused internal features.
Pull Request resolved: pytorch#138767
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766, pytorch#138956
Ryo-not-rio pushed a commit to Ryo-not-rio/pytorch that referenced this pull request Dec 2, 2024
…8956)

This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.
Pull Request resolved: pytorch#138956
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766
Ryo-not-rio pushed a commit to Ryo-not-rio/pytorch that referenced this pull request Dec 2, 2024
This never ended up getting used, and instead we're doing this
resolution within the configuration system.

Removing these unused internal features.
Pull Request resolved: pytorch#138767
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766, pytorch#138956
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
…8956)

This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.
Pull Request resolved: pytorch#138956
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766
pobin6 pushed a commit to pobin6/pytorch that referenced this pull request Dec 5, 2024
This never ended up getting used, and instead we're doing this
resolution within the configuration system.

Removing these unused internal features.
Pull Request resolved: pytorch#138767
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766, pytorch#138956
@github-actions github-actions bot deleted the gh/c00w/4/head branch December 8, 2024 02:16
fmo-mt pushed a commit to fmo-mt/pytorch that referenced this pull request Dec 11, 2024
…8956)

This allows Configs to handle setting their defaults (or overriding
themselves) via environment variables.

The environment variables are resolved at install time (which is usually
import time). This is done 1) to avoid any race conditions between
threads etc..., but 2) to help encourage people to just go modify the
configs directly, vs overriding environment variables to change
pytorch behaviour.
Pull Request resolved: pytorch#138956
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766
fmo-mt pushed a commit to fmo-mt/pytorch that referenced this pull request Dec 11, 2024
This never ended up getting used, and instead we're doing this
resolution within the configuration system.

Removing these unused internal features.
Pull Request resolved: pytorch#138767
Approved by: https://github.com/ezyang
ghstack dependencies: pytorch#138766, pytorch#138956
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: inductor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants