torchx
torchx copied to clipboard
[py310+] custom components binary operator not supported in file linting
🐛 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:
- with python 3.10+ create and register any custom component, and use binopt instead of typing.Optional
- example client:
Any | None = None
, instead ofclient: 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: