torchx-nightly 2025.9.18__py3-none-any.whl → 2025.9.20__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/__init__.py +10 -5
- torchx/specs/api.py +4 -1
- torchx/specs/builders.py +5 -5
- torchx/specs/finder.py +4 -3
- torchx/util/types.py +12 -1
- {torchx_nightly-2025.9.18.dist-info → torchx_nightly-2025.9.20.dist-info}/METADATA +1 -1
- {torchx_nightly-2025.9.18.dist-info → torchx_nightly-2025.9.20.dist-info}/RECORD +11 -11
- {torchx_nightly-2025.9.18.dist-info → torchx_nightly-2025.9.20.dist-info}/LICENSE +0 -0
- {torchx_nightly-2025.9.18.dist-info → torchx_nightly-2025.9.20.dist-info}/WHEEL +0 -0
- {torchx_nightly-2025.9.18.dist-info → torchx_nightly-2025.9.20.dist-info}/entry_points.txt +0 -0
- {torchx_nightly-2025.9.18.dist-info → torchx_nightly-2025.9.20.dist-info}/top_level.txt +0 -0
torchx/specs/__init__.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
1
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
2
|
# All rights reserved.
|
|
4
3
|
#
|
|
@@ -52,14 +51,19 @@ from torchx.util.entrypoints import load_group
|
|
|
52
51
|
|
|
53
52
|
from torchx.util.modules import import_attr
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
GiB: int = 1024
|
|
55
|
+
|
|
56
|
+
ResourceFactory = Callable[[], Resource]
|
|
57
|
+
|
|
58
|
+
AWS_NAMED_RESOURCES: Mapping[str, ResourceFactory] = import_attr(
|
|
56
59
|
"torchx.specs.named_resources_aws", "NAMED_RESOURCES", default={}
|
|
57
60
|
)
|
|
58
|
-
GENERIC_NAMED_RESOURCES: Mapping[str,
|
|
61
|
+
GENERIC_NAMED_RESOURCES: Mapping[str, ResourceFactory] = import_attr(
|
|
59
62
|
"torchx.specs.named_resources_generic", "NAMED_RESOURCES", default={}
|
|
60
63
|
)
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
FB_NAMED_RESOURCES: Mapping[str, ResourceFactory] = import_attr(
|
|
65
|
+
"torchx.specs.fb.named_resources", "NAMED_RESOURCES", default={}
|
|
66
|
+
)
|
|
63
67
|
|
|
64
68
|
|
|
65
69
|
def _load_named_resources() -> Dict[str, Callable[[], Resource]]:
|
|
@@ -69,6 +73,7 @@ def _load_named_resources() -> Dict[str, Callable[[], Resource]]:
|
|
|
69
73
|
for name, resource in {
|
|
70
74
|
**GENERIC_NAMED_RESOURCES,
|
|
71
75
|
**AWS_NAMED_RESOURCES,
|
|
76
|
+
**FB_NAMED_RESOURCES,
|
|
72
77
|
**resource_methods,
|
|
73
78
|
}.items():
|
|
74
79
|
materialized_resources[name] = resource
|
torchx/specs/api.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
1
|
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
2
|
# All rights reserved.
|
|
4
3
|
#
|
|
@@ -83,6 +82,8 @@ class Resource:
|
|
|
83
82
|
memMB: MB of ram
|
|
84
83
|
capabilities: additional hardware specs (interpreted by scheduler)
|
|
85
84
|
devices: a list of named devices with their quantities
|
|
85
|
+
tags: metadata tags for the resource (not interpreted by schedulers)
|
|
86
|
+
used to add non-functional information about resources (e.g. whether it is an alias of another resource)
|
|
86
87
|
|
|
87
88
|
Note: you should prefer to use named_resources instead of specifying the raw
|
|
88
89
|
resource requirement directly.
|
|
@@ -93,6 +94,7 @@ class Resource:
|
|
|
93
94
|
memMB: int
|
|
94
95
|
capabilities: Dict[str, Any] = field(default_factory=dict)
|
|
95
96
|
devices: Dict[str, int] = field(default_factory=dict)
|
|
97
|
+
tags: Dict[str, object] = field(default_factory=dict)
|
|
96
98
|
|
|
97
99
|
@staticmethod
|
|
98
100
|
def copy(original: "Resource", **capabilities: Any) -> "Resource":
|
|
@@ -101,6 +103,7 @@ class Resource:
|
|
|
101
103
|
are present in the original resource and as parameter, the one from parameter
|
|
102
104
|
will be used.
|
|
103
105
|
"""
|
|
106
|
+
|
|
104
107
|
res_capabilities = dict(original.capabilities)
|
|
105
108
|
res_capabilities.update(capabilities)
|
|
106
109
|
return Resource(
|
torchx/specs/builders.py
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# This source code is licensed under the BSD-style license found in the
|
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
|
6
6
|
|
|
7
|
-
# pyre-
|
|
7
|
+
# pyre-unsafe
|
|
8
8
|
|
|
9
9
|
import argparse
|
|
10
10
|
import inspect
|
|
@@ -39,7 +39,7 @@ def _create_args_parser(
|
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
def _create_args_parser_from_parameters(
|
|
42
|
-
cmpnt_fn: Callable[...,
|
|
42
|
+
cmpnt_fn: Callable[..., AppDef],
|
|
43
43
|
parameters: Mapping[str, inspect.Parameter],
|
|
44
44
|
cmpnt_defaults: Optional[Dict[str, str]] = None,
|
|
45
45
|
config: Optional[Dict[str, Any]] = None,
|
|
@@ -120,7 +120,7 @@ def _merge_config_values_with_args(
|
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
def parse_args(
|
|
123
|
-
cmpnt_fn: Callable[...,
|
|
123
|
+
cmpnt_fn: Callable[..., AppDef],
|
|
124
124
|
cmpnt_args: List[str],
|
|
125
125
|
cmpnt_defaults: Optional[Dict[str, Any]] = None,
|
|
126
126
|
config: Optional[Dict[str, Any]] = None,
|
|
@@ -149,7 +149,7 @@ def parse_args(
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
def component_args_from_str(
|
|
152
|
-
cmpnt_fn: Callable[...,
|
|
152
|
+
cmpnt_fn: Callable[..., AppDef],
|
|
153
153
|
cmpnt_args: list[str],
|
|
154
154
|
cmpnt_args_defaults: Optional[Dict[str, Any]] = None,
|
|
155
155
|
config: Optional[Dict[str, Any]] = None,
|
|
@@ -238,7 +238,7 @@ def component_args_from_str(
|
|
|
238
238
|
|
|
239
239
|
|
|
240
240
|
def materialize_appdef(
|
|
241
|
-
cmpnt_fn: Callable[...,
|
|
241
|
+
cmpnt_fn: Callable[..., AppDef],
|
|
242
242
|
cmpnt_args: List[str],
|
|
243
243
|
cmpnt_defaults: Optional[Dict[str, Any]] = None,
|
|
244
244
|
config: Optional[Dict[str, Any]] = None,
|
torchx/specs/finder.py
CHANGED
|
@@ -17,7 +17,9 @@ from dataclasses import dataclass
|
|
|
17
17
|
from inspect import getmembers, isfunction
|
|
18
18
|
from pathlib import Path
|
|
19
19
|
from types import ModuleType
|
|
20
|
-
from typing import
|
|
20
|
+
from typing import Callable, Dict, Generator, List, Optional, Union
|
|
21
|
+
|
|
22
|
+
from torchx.specs import AppDef
|
|
21
23
|
|
|
22
24
|
from torchx.specs.file_linter import (
|
|
23
25
|
ComponentFunctionValidator,
|
|
@@ -59,8 +61,7 @@ class _Component:
|
|
|
59
61
|
description: str
|
|
60
62
|
fn_name: str
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
fn: Callable[..., Any]
|
|
64
|
+
fn: Callable[..., AppDef]
|
|
64
65
|
|
|
65
66
|
validation_errors: List[str]
|
|
66
67
|
|
torchx/util/types.py
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import inspect
|
|
10
10
|
import re
|
|
11
|
+
from types import UnionType
|
|
11
12
|
from typing import Any, Callable, Optional, Tuple, TypeVar, Union
|
|
12
13
|
|
|
13
14
|
|
|
@@ -234,10 +235,20 @@ def decode_optional(param_type: Any) -> Any:
|
|
|
234
235
|
If ``param_type`` is type Optional[INNER_TYPE], method returns INNER_TYPE
|
|
235
236
|
Otherwise returns ``param_type``
|
|
236
237
|
"""
|
|
238
|
+
|
|
237
239
|
if not hasattr(param_type, "__origin__"):
|
|
238
|
-
|
|
240
|
+
if isinstance(param_type, UnionType):
|
|
241
|
+
# handle BinOp style Optional (e.g. `T | None`)
|
|
242
|
+
if len(param_type.__args__) == 2 and param_type.__args__[1] is type(None):
|
|
243
|
+
return param_type.__args__[0]
|
|
244
|
+
else:
|
|
245
|
+
return param_type
|
|
246
|
+
else:
|
|
247
|
+
return param_type
|
|
248
|
+
|
|
239
249
|
if param_type.__origin__ is not Union:
|
|
240
250
|
return param_type
|
|
251
|
+
|
|
241
252
|
args = param_type.__args__
|
|
242
253
|
if len(args) == 2 and args[1] is type(None):
|
|
243
254
|
return args[0]
|
|
@@ -70,11 +70,11 @@ torchx/schedulers/local_scheduler.py,sha256=ttnxFDy48_DSYDEW-no27OirFZOyfrjwJ2S1
|
|
|
70
70
|
torchx/schedulers/lsf_scheduler.py,sha256=YS6Yel8tXJqLPxbcGz95lZG2nCi36AQXdNDyuBJePKg,17661
|
|
71
71
|
torchx/schedulers/slurm_scheduler.py,sha256=vZt102OxuTGj0ZE-V9dWbldtOyL2VbHcxADm_osL7Y4,31568
|
|
72
72
|
torchx/schedulers/streams.py,sha256=8_SLezgnWgfv_zXUsJCUM34-h2dtv25NmZuxEwkzmxw,2007
|
|
73
|
-
torchx/specs/__init__.py,sha256=
|
|
74
|
-
torchx/specs/api.py,sha256=
|
|
75
|
-
torchx/specs/builders.py,sha256=
|
|
73
|
+
torchx/specs/__init__.py,sha256=HU7OoXs7aBBi0IenB49QIONRzoG1Ovs1Qlm9KnsvqfE,6609
|
|
74
|
+
torchx/specs/api.py,sha256=Rzv_Yx8yyseARbC928ZvqAZbvaXhJRDAbcyPsxiblF4,41543
|
|
75
|
+
torchx/specs/builders.py,sha256=Ye3of4MupJ-da8vLaX6_-nzGo_FRw1BFpYsX6dAZCNk,13730
|
|
76
76
|
torchx/specs/file_linter.py,sha256=6_aoeuS5d9UwXseKKfPgWNTwxj-f7G1i3uO9mQepti4,14402
|
|
77
|
-
torchx/specs/finder.py,sha256=
|
|
77
|
+
torchx/specs/finder.py,sha256=KbtyQ2ZUIgg4vgIUdmvAis7es5CCnLtdbvxdusWkv3c,17433
|
|
78
78
|
torchx/specs/named_resources_aws.py,sha256=ISjHtifRJqB8u7PeAMiyLyO_S0WCaZiK-CFF3qe6JDU,11415
|
|
79
79
|
torchx/specs/named_resources_generic.py,sha256=Sg4tAdqiiWDrDz2Lj_pnfsjzGIXKTou73wPseh6j55w,2646
|
|
80
80
|
torchx/specs/test/components/__init__.py,sha256=J8qjUOysmcMAek2KFN13mViOXZxTYc5vCrF02t3VuFU,223
|
|
@@ -98,14 +98,14 @@ torchx/util/modules.py,sha256=o4y_d07gTpJ4nIVBcoUVJ0JtXIHEsEC5kbgBM6NGpgA,2135
|
|
|
98
98
|
torchx/util/session.py,sha256=r6M_nyzXgcbk1GgYGZ324F_ehRGCqjjdVk4YgKxMj8M,1214
|
|
99
99
|
torchx/util/shlex.py,sha256=eXEKu8KC3zIcd8tEy9_s8Ds5oma8BORr-0VGWNpG2dk,463
|
|
100
100
|
torchx/util/strings.py,sha256=GkLWCmYS89Uv6bWc5hH0XwvHy7oQmprv2U7axC4A2e8,678
|
|
101
|
-
torchx/util/types.py,sha256=
|
|
101
|
+
torchx/util/types.py,sha256=E9dxAWQnsJkIDuHtg-poeOJ4etucSI_xP_Z5kNJX8uI,9229
|
|
102
102
|
torchx/workspace/__init__.py,sha256=cZsKVvUWwDYcGhe6SCXQGBQfbk_yTnKEImOkI6xmu30,809
|
|
103
103
|
torchx/workspace/api.py,sha256=Ct_75VU94fsH9Rf1WRe-wJGpVgl5O05S_Dq_t2ArJWA,11348
|
|
104
104
|
torchx/workspace/dir_workspace.py,sha256=npNW_IjUZm_yS5r-8hrRkH46ndDd9a_eApT64m1S1T4,2268
|
|
105
105
|
torchx/workspace/docker_workspace.py,sha256=PFu2KQNVC-0p2aKJ-W_BKA9ZOmXdCY2ABEkCExp3udQ,10269
|
|
106
|
-
torchx_nightly-2025.9.
|
|
107
|
-
torchx_nightly-2025.9.
|
|
108
|
-
torchx_nightly-2025.9.
|
|
109
|
-
torchx_nightly-2025.9.
|
|
110
|
-
torchx_nightly-2025.9.
|
|
111
|
-
torchx_nightly-2025.9.
|
|
106
|
+
torchx_nightly-2025.9.20.dist-info/LICENSE,sha256=WVHfXhFC0Ia8LTKt_nJVYobdqTJVg_4J3Crrfm2A8KQ,1721
|
|
107
|
+
torchx_nightly-2025.9.20.dist-info/METADATA,sha256=aPB9mczLC1zcLm306MmyOo-9jc_YNIRx4Iuax3hq3KU,5693
|
|
108
|
+
torchx_nightly-2025.9.20.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
|
|
109
|
+
torchx_nightly-2025.9.20.dist-info/entry_points.txt,sha256=T328AMXeKI3JZnnxfkEew2ZcMN1oQDtkXjMz7lkV-P4,169
|
|
110
|
+
torchx_nightly-2025.9.20.dist-info/top_level.txt,sha256=pxew3bc2gsiViS0zADs0jb6kC5v8o_Yy_85fhHj_J1A,7
|
|
111
|
+
torchx_nightly-2025.9.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|