torchx-nightly 2025.10.12__py3-none-any.whl → 2025.10.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of torchx-nightly might be problematic. Click here for more details.
- torchx/specs/api.py +68 -6
- {torchx_nightly-2025.10.12.dist-info → torchx_nightly-2025.10.14.dist-info}/METADATA +1 -1
- {torchx_nightly-2025.10.12.dist-info → torchx_nightly-2025.10.14.dist-info}/RECORD +7 -7
- {torchx_nightly-2025.10.12.dist-info → torchx_nightly-2025.10.14.dist-info}/LICENSE +0 -0
- {torchx_nightly-2025.10.12.dist-info → torchx_nightly-2025.10.14.dist-info}/WHEEL +0 -0
- {torchx_nightly-2025.10.12.dist-info → torchx_nightly-2025.10.14.dist-info}/entry_points.txt +0 -0
- {torchx_nightly-2025.10.12.dist-info → torchx_nightly-2025.10.14.dist-info}/top_level.txt +0 -0
torchx/specs/api.py
CHANGED
|
@@ -891,10 +891,14 @@ class runopt:
|
|
|
891
891
|
Represents the metadata about the specific run option
|
|
892
892
|
"""
|
|
893
893
|
|
|
894
|
+
class alias(str):
|
|
895
|
+
pass
|
|
896
|
+
|
|
894
897
|
default: CfgVal
|
|
895
898
|
opt_type: Type[CfgVal]
|
|
896
899
|
is_required: bool
|
|
897
900
|
help: str
|
|
901
|
+
aliases: list[alias] | None = None
|
|
898
902
|
|
|
899
903
|
@property
|
|
900
904
|
def is_type_list_of_str(self) -> bool:
|
|
@@ -986,6 +990,7 @@ class runopts:
|
|
|
986
990
|
|
|
987
991
|
def __init__(self) -> None:
|
|
988
992
|
self._opts: Dict[str, runopt] = {}
|
|
993
|
+
self._alias_to_key: dict[runopt.alias, str] = {}
|
|
989
994
|
|
|
990
995
|
def __iter__(self) -> Iterator[Tuple[str, runopt]]:
|
|
991
996
|
return self._opts.items().__iter__()
|
|
@@ -1013,9 +1018,16 @@ class runopts:
|
|
|
1013
1018
|
|
|
1014
1019
|
def get(self, name: str) -> Optional[runopt]:
|
|
1015
1020
|
"""
|
|
1016
|
-
Returns option if any was registered, or None otherwise
|
|
1021
|
+
Returns option if any was registered, or None otherwise.
|
|
1022
|
+
First searches for the option by ``name``, then falls-back to matching ``name`` with any
|
|
1023
|
+
registered aliases.
|
|
1024
|
+
|
|
1017
1025
|
"""
|
|
1018
|
-
|
|
1026
|
+
if name in self._opts:
|
|
1027
|
+
return self._opts[name]
|
|
1028
|
+
if name in self._alias_to_key:
|
|
1029
|
+
return self._opts[self._alias_to_key[name]]
|
|
1030
|
+
return None
|
|
1019
1031
|
|
|
1020
1032
|
def resolve(self, cfg: Mapping[str, CfgVal]) -> Dict[str, CfgVal]:
|
|
1021
1033
|
"""
|
|
@@ -1030,6 +1042,24 @@ class runopts:
|
|
|
1030
1042
|
|
|
1031
1043
|
for cfg_key, runopt in self._opts.items():
|
|
1032
1044
|
val = resolved_cfg.get(cfg_key)
|
|
1045
|
+
resolved_name = None
|
|
1046
|
+
aliases = runopt.aliases or []
|
|
1047
|
+
if val is None:
|
|
1048
|
+
for alias in aliases:
|
|
1049
|
+
val = resolved_cfg.get(alias)
|
|
1050
|
+
if alias in cfg or val is not None:
|
|
1051
|
+
resolved_name = alias
|
|
1052
|
+
break
|
|
1053
|
+
else:
|
|
1054
|
+
resolved_name = cfg_key
|
|
1055
|
+
for alias in aliases:
|
|
1056
|
+
duplicate_val = resolved_cfg.get(alias)
|
|
1057
|
+
if alias in cfg or duplicate_val is not None:
|
|
1058
|
+
raise InvalidRunConfigException(
|
|
1059
|
+
f"Duplicate opt name. runopt: `{resolved_name}``, is an alias of runopt: `{alias}`",
|
|
1060
|
+
resolved_name,
|
|
1061
|
+
cfg,
|
|
1062
|
+
)
|
|
1033
1063
|
|
|
1034
1064
|
# check required opt
|
|
1035
1065
|
if runopt.is_required and val is None:
|
|
@@ -1049,7 +1079,7 @@ class runopts:
|
|
|
1049
1079
|
)
|
|
1050
1080
|
|
|
1051
1081
|
# not required and not set, set to default
|
|
1052
|
-
if val is None:
|
|
1082
|
+
if val is None and resolved_name is None:
|
|
1053
1083
|
resolved_cfg[cfg_key] = runopt.default
|
|
1054
1084
|
return resolved_cfg
|
|
1055
1085
|
|
|
@@ -1142,9 +1172,38 @@ class runopts:
|
|
|
1142
1172
|
cfg[key] = val
|
|
1143
1173
|
return cfg
|
|
1144
1174
|
|
|
1175
|
+
def _get_primary_key_and_aliases(
|
|
1176
|
+
self,
|
|
1177
|
+
cfg_key: list[str] | str,
|
|
1178
|
+
) -> tuple[str, list[runopt.alias]]:
|
|
1179
|
+
"""
|
|
1180
|
+
Returns the primary key and aliases for the given cfg_key.
|
|
1181
|
+
"""
|
|
1182
|
+
if isinstance(cfg_key, str):
|
|
1183
|
+
return cfg_key, []
|
|
1184
|
+
|
|
1185
|
+
if len(cfg_key) == 0:
|
|
1186
|
+
raise ValueError("cfg_key must be a non-empty list")
|
|
1187
|
+
primary_key = None
|
|
1188
|
+
aliases = list[runopt.alias]()
|
|
1189
|
+
for name in cfg_key:
|
|
1190
|
+
if isinstance(name, runopt.alias):
|
|
1191
|
+
aliases.append(name)
|
|
1192
|
+
else:
|
|
1193
|
+
if primary_key is not None:
|
|
1194
|
+
raise ValueError(
|
|
1195
|
+
f" Given more than one primary key: {primary_key}, {name}. Please use runopt.alias type for aliases. "
|
|
1196
|
+
)
|
|
1197
|
+
primary_key = name
|
|
1198
|
+
if primary_key is None or primary_key == "":
|
|
1199
|
+
raise ValueError(
|
|
1200
|
+
"Missing cfg_key. Please provide one other than the aliases."
|
|
1201
|
+
)
|
|
1202
|
+
return primary_key, aliases
|
|
1203
|
+
|
|
1145
1204
|
def add(
|
|
1146
1205
|
self,
|
|
1147
|
-
cfg_key: str,
|
|
1206
|
+
cfg_key: str | list[str],
|
|
1148
1207
|
type_: Type[CfgVal],
|
|
1149
1208
|
help: str,
|
|
1150
1209
|
default: CfgVal = None,
|
|
@@ -1155,6 +1214,7 @@ class runopts:
|
|
|
1155
1214
|
value (if any). If the ``default`` is not specified then this option
|
|
1156
1215
|
is a required option.
|
|
1157
1216
|
"""
|
|
1217
|
+
primary_key, aliases = self._get_primary_key_and_aliases(cfg_key)
|
|
1158
1218
|
if required and default is not None:
|
|
1159
1219
|
raise ValueError(
|
|
1160
1220
|
f"Required option: {cfg_key} must not specify default value. Given: {default}"
|
|
@@ -1165,8 +1225,10 @@ class runopts:
|
|
|
1165
1225
|
f"Option: {cfg_key}, must be of type: {type_}."
|
|
1166
1226
|
f" Given: {default} ({type(default).__name__})"
|
|
1167
1227
|
)
|
|
1168
|
-
|
|
1169
|
-
|
|
1228
|
+
opt = runopt(default, type_, required, help, aliases)
|
|
1229
|
+
for alias in aliases:
|
|
1230
|
+
self._alias_to_key[alias] = primary_key
|
|
1231
|
+
self._opts[primary_key] = opt
|
|
1170
1232
|
|
|
1171
1233
|
def update(self, other: "runopts") -> None:
|
|
1172
1234
|
self._opts.update(other._opts)
|
|
@@ -70,7 +70,7 @@ torchx/schedulers/lsf_scheduler.py,sha256=YS6Yel8tXJqLPxbcGz95lZG2nCi36AQXdNDyuB
|
|
|
70
70
|
torchx/schedulers/slurm_scheduler.py,sha256=vypGaCZe61bkyNkqRlK4Iwmk_NaAUQi-DsspaWd6BZw,31873
|
|
71
71
|
torchx/schedulers/streams.py,sha256=8_SLezgnWgfv_zXUsJCUM34-h2dtv25NmZuxEwkzmxw,2007
|
|
72
72
|
torchx/specs/__init__.py,sha256=XpyR3PPcv5IwZg5iX18KDoRhDFqUoQm7o4ANo6lOo78,6683
|
|
73
|
-
torchx/specs/api.py,sha256=
|
|
73
|
+
torchx/specs/api.py,sha256=ICKsTWxEats9IwWXUm-D1NJy4jyONMV2zdrWfUrpKNg,47827
|
|
74
74
|
torchx/specs/builders.py,sha256=Ye3of4MupJ-da8vLaX6_-nzGo_FRw1BFpYsX6dAZCNk,13730
|
|
75
75
|
torchx/specs/file_linter.py,sha256=z0c4mKJv47BWiPaWCdUM0A8kHwnj4b1s7oTmESuD9Tc,14407
|
|
76
76
|
torchx/specs/finder.py,sha256=gWQNEFrLYqrZoI0gMMhQ70YAC4sxqS0ZFpoWAmcVi44,17438
|
|
@@ -102,9 +102,9 @@ torchx/workspace/__init__.py,sha256=cZsKVvUWwDYcGhe6SCXQGBQfbk_yTnKEImOkI6xmu30,
|
|
|
102
102
|
torchx/workspace/api.py,sha256=h2SaC-pYPBLuo3XtkXJ0APMoro-C-ry7KucI7r3EUf4,8753
|
|
103
103
|
torchx/workspace/dir_workspace.py,sha256=npNW_IjUZm_yS5r-8hrRkH46ndDd9a_eApT64m1S1T4,2268
|
|
104
104
|
torchx/workspace/docker_workspace.py,sha256=PFu2KQNVC-0p2aKJ-W_BKA9ZOmXdCY2ABEkCExp3udQ,10269
|
|
105
|
-
torchx_nightly-2025.10.
|
|
106
|
-
torchx_nightly-2025.10.
|
|
107
|
-
torchx_nightly-2025.10.
|
|
108
|
-
torchx_nightly-2025.10.
|
|
109
|
-
torchx_nightly-2025.10.
|
|
110
|
-
torchx_nightly-2025.10.
|
|
105
|
+
torchx_nightly-2025.10.14.dist-info/LICENSE,sha256=WVHfXhFC0Ia8LTKt_nJVYobdqTJVg_4J3Crrfm2A8KQ,1721
|
|
106
|
+
torchx_nightly-2025.10.14.dist-info/METADATA,sha256=-bXJDebNwQnHA8ulYgPmj1e5l1k5y7qmJQzNzhkuX0w,5069
|
|
107
|
+
torchx_nightly-2025.10.14.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
108
|
+
torchx_nightly-2025.10.14.dist-info/entry_points.txt,sha256=T328AMXeKI3JZnnxfkEew2ZcMN1oQDtkXjMz7lkV-P4,169
|
|
109
|
+
torchx_nightly-2025.10.14.dist-info/top_level.txt,sha256=pxew3bc2gsiViS0zADs0jb6kC5v8o_Yy_85fhHj_J1A,7
|
|
110
|
+
torchx_nightly-2025.10.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{torchx_nightly-2025.10.12.dist-info → torchx_nightly-2025.10.14.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|