Commit 99567d2
(torchx/specs) Support builtin list[str] and dict[str, str] runopts opt_type
Summary:
For python-3.9+ support scheduler runopt types to be specified using the built-in generic types (e.g. `list[str]` over `typing.List[str]`).
Basically lets scheduler implementations to declare their runopts (cfg) as:
```
def _run_opts(self) -> runopts:
opts = runopts()
opts.add("regions", type_=list[str], help="a list opt", default=[])
opts.add("envs", type_=dict[str, str], help="a dict opt", default=[])
```
versus having to do:
```
from typing import List, Dict
def _run_opts(self) -> runopts:
opts = runopts()
opts.add("regions", type_=List[str], help="a list opt", default=[])
opts.add("envs", type_=Dict[str, str], help="a dict opt", default=[])
```
Differential Revision: D784441061 parent 6641ab3 commit 99567d2
2 files changed
+37
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
951 | 951 | | |
952 | 952 | | |
953 | 953 | | |
954 | | - | |
| 954 | + | |
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
958 | | - | |
| 958 | + | |
959 | 959 | | |
960 | 960 | | |
961 | 961 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
569 | 604 | | |
570 | 605 | | |
571 | 606 | | |
| |||
0 commit comments