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

Make torchx scheduler opts support enums #870

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andywag
Copy link
Contributor

@andywag andywag commented Mar 30, 2024

Summary:
Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233

@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 30, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

andywag added a commit to andywag/torchx that referenced this pull request Mar 31, 2024
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

andywag added a commit to andywag/torchx that referenced this pull request Mar 31, 2024
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

1 similar comment
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

andywag added a commit to andywag/torchx that referenced this pull request Apr 1, 2024
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@andywag andywag force-pushed the export-D55551233 branch from 64524dd to e8715ab Compare April 1, 2024 20:07
andywag added a commit to andywag/torchx that referenced this pull request Apr 1, 2024
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@andywag andywag force-pushed the export-D55551233 branch from e8715ab to b9573f0 Compare April 1, 2024 20:10
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

@andywag andywag force-pushed the export-D55551233 branch from b9573f0 to aee0801 Compare April 1, 2024 20:11
andywag added a commit to andywag/torchx that referenced this pull request Apr 1, 2024
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

andywag added a commit to andywag/torchx that referenced this pull request Apr 1, 2024
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@andywag andywag force-pushed the export-D55551233 branch from aee0801 to da0152a Compare April 1, 2024 21:57
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

andywag added a commit to andywag/torchx that referenced this pull request Apr 2, 2024
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@andywag andywag force-pushed the export-D55551233 branch from da0152a to 5e1d68d Compare April 2, 2024 19:30
Summary:

Added Support for Enumerations in scheduler options.

This is a bit more generic as it takes in a creator function which converts a CfgVal to another type. There are some limitations on how general it can be based on how the typing is setup. This also makes it tricky to make a convenience function to handle only Enums.

Differential Revision: D55551233
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

@andywag andywag force-pushed the export-D55551233 branch from 5e1d68d to 4227419 Compare April 2, 2024 19:31
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D55551233

@@ -702,6 +702,7 @@ class runopt:
opt_type: Type[CfgVal]
is_required: bool
help: str
creator: Optional[Callable[[CfgVal], CfgVal]] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Its not clear how to use this creator. Can/should I use a creator for a primitive CfgVal (eg ones that are not enums)?

In general schedule options were kept dead simple because they are meant to be directly parsable from command-line (after all torchx is mostly used from CLI). This is why they are not structured, and only basic type checking is done for sanity. Enums are tricky to support especially when the values are sent over the wire and as such support for enums in scheduler opts should be well motivated and thorougly justified as we would be trading off simplicity/clarity for .

I'd like to understand the motivation behind wanting to support enums for scheduler opts before we add them. cc @d4l3k

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. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants