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

[py310+] custom components binary operator not supported in file linting #826

Open
9 tasks
ryxli opened this issue Feb 16, 2024 · 0 comments
Open
9 tasks

Comments

@ryxli
Copy link
Contributor

ryxli commented Feb 16, 2024

🐛 Bug

custom components using binop instead of Optional result in validation error.

custom schedulers work as intended as there is no validation

Module (check all that applies):

  • [x ] torchx.spec
  • torchx.component
  • torchx.apps
  • torchx.runtime
  • torchx.cli
  • torchx.schedulers
  • torchx.pipelines
  • torchx.aws
  • torchx.examples
  • other

torchx.specs.file_linter

To Reproduce

Steps to reproduce the behavior:

  1. with python 3.10+ create and register any custom component, and use binopt instead of typing.Optional
  2. example client: Any | None = None, instead of client: Optional[Any] = None
  File "lib/python3.10/site-packages/torchx/specs/file_linter.py", line 144, in _validate_arg_def
    if complex_type_def.value.id == "Optional":
AttributeError: 'BinOp' object has no attribute 'value'

Expected behavior

have an edge case for 3.10 where this does not cause component validation to fail

Environment

  • torchx version (e.g. 0.1.0rc1): 0.6.0
  • Python version: 3.10
  • OS (e.g., Linux):
  • How you installed torchx (conda, pip, source, docker):
  • Docker image and tag (if using docker):
  • Git commit (if installed from source):
  • Execution environment (on-prem, AWS, GCP, Azure etc):
  • Any other relevant information:

Additional context

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

1 participant