torchx-nightly 2025.4.19__py3-none-any.whl → 2025.4.21__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/cli/cmd_status.py CHANGED
@@ -8,6 +8,7 @@
8
8
  # pyre-strict
9
9
 
10
10
  import argparse
11
+ import json
11
12
  import logging
12
13
  import sys
13
14
  from typing import List, Optional
@@ -46,6 +47,11 @@ class CmdStatus(SubCommand):
46
47
  subparser.add_argument(
47
48
  "--roles", type=str, default="", help="comma separated roles to filter"
48
49
  )
50
+ subparser.add_argument(
51
+ "--json",
52
+ action="store_true",
53
+ help="output the status in JSON format",
54
+ )
49
55
 
50
56
  def run(self, args: argparse.Namespace) -> None:
51
57
  app_handle = args.app_handle
@@ -54,7 +60,10 @@ class CmdStatus(SubCommand):
54
60
  app_status = runner.status(app_handle)
55
61
  filter_roles = parse_list_arg(args.roles)
56
62
  if app_status:
57
- print(app_status.format(filter_roles))
63
+ if args.json:
64
+ print(json.dumps(app_status.to_json(filter_roles)))
65
+ else:
66
+ print(app_status.format(filter_roles))
58
67
  else:
59
68
  logger.error(
60
69
  f"AppDef: {app_id},"
torchx/specs/api.py CHANGED
@@ -538,6 +538,15 @@ class RoleStatus:
538
538
  role: str
539
539
  replicas: List[ReplicaStatus]
540
540
 
541
+ def to_json(self) -> Dict[str, Any]:
542
+ """
543
+ Convert the RoleStatus to a json object.
544
+ """
545
+ return {
546
+ "role": self.role,
547
+ "replicas": [asdict(replica) for replica in self.replicas],
548
+ }
549
+
541
550
 
542
551
  @dataclass
543
552
  class AppStatus:
@@ -657,6 +666,21 @@ class AppStatus:
657
666
  replica_data += self._format_replica_status(replica)
658
667
  return f"{replica_data}"
659
668
 
669
+ def to_json(self, filter_roles: Optional[List[str]] = None) -> Dict[str, Any]:
670
+ """
671
+ Convert the AppStatus to a json object, including RoleStatus.
672
+ """
673
+ roles = self._get_role_statuses(self.roles, filter_roles)
674
+
675
+ return {
676
+ "state": str(self.state),
677
+ "num_restarts": self.num_restarts,
678
+ "roles": [role_status.to_json() for role_status in roles],
679
+ "msg": self.msg,
680
+ "structured_error_msg": self.structured_error_msg,
681
+ "url": self.ui_url,
682
+ }
683
+
660
684
  def format(
661
685
  self,
662
686
  filter_roles: Optional[List[str]] = None,
@@ -672,6 +696,7 @@ class AppStatus:
672
696
  """
673
697
  roles_data = ""
674
698
  roles = self._get_role_statuses(self.roles, filter_roles)
699
+
675
700
  for role_status in roles:
676
701
  roles_data += self._format_role_status(role_status)
677
702
  return Template(_APP_STATUS_FORMAT_TEMPLATE).substitute(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: torchx-nightly
3
- Version: 2025.4.19
3
+ Version: 2025.4.21
4
4
  Summary: TorchX SDK and Components
5
5
  Home-page: https://github.com/pytorch/torchx
6
6
  Author: TorchX Devs
@@ -18,7 +18,7 @@ torchx/cli/cmd_list.py,sha256=BVqHEW2oTEJ3GqcFK7c1K-i2R-DUjaXQ-WBr0meeIGM,1429
18
18
  torchx/cli/cmd_log.py,sha256=v-EZYUDOcG95rEgTnrsmPJMUyxM9Mk8YFAJtUxtgViE,5475
19
19
  torchx/cli/cmd_run.py,sha256=4M1JJc7YmEa5T_2OFakCwCwiP0Ibpy-3zcLp1arrj9w,12203
20
20
  torchx/cli/cmd_runopts.py,sha256=NWZiP8XpQjfTDJgays2c6MgL_8wxFoeDge6NstaZdKk,1302
21
- torchx/cli/cmd_status.py,sha256=ubtmCp4PylrIh_kC3ZJ5QJm7lzXRt_aRPmY7j-sZu_0,1836
21
+ torchx/cli/cmd_status.py,sha256=22IAEmKs0qkG6kJi83u9dRX2Q-ntT7yehVx7FxtY-vQ,2114
22
22
  torchx/cli/cmd_tracker.py,sha256=RfLxE4Cq1wfk7k051RtZ8RPJp0pEKSCa3KmTeRs3LF8,5218
23
23
  torchx/cli/colors.py,sha256=yLMes7e_UoLAfhxE0W6edhc58t83UHAlnCN2ANPeuXw,568
24
24
  torchx/cli/main.py,sha256=1Jf2cnO6Y2W69Adt88avmNPVrL6ZR4Hkff6GVB4293k,3484
@@ -83,7 +83,7 @@ torchx/schedulers/ray/__init__.py,sha256=fE0IHi1JJpxsNVBNzWNee2thrNXFFRhY94c80Rx
83
83
  torchx/schedulers/ray/ray_common.py,sha256=pyNYFvTKVwdjDAeCBNbPwAWwVNmlLOJWExfn90XY8u8,610
84
84
  torchx/schedulers/ray/ray_driver.py,sha256=RdaCLfth16ky-5PDVOWRe_RuheWJu9xufWux2F9T7iw,12302
85
85
  torchx/specs/__init__.py,sha256=T8xUCz7iVE6OsUL5P4Pzy2B8ZY_YinCVDwUer5Q-XPc,6179
86
- torchx/specs/api.py,sha256=ISdnfGH1R0-1Ah23UsPOZQT3WH63dIMj9CxA3QRoP0g,38046
86
+ torchx/specs/api.py,sha256=jtasrQUy_6-AmZxsfZ_6J-kfUGKYsO5cVsrCP3imZ-I,38844
87
87
  torchx/specs/builders.py,sha256=f5Yy8KoL2OgPUiqJRkZ4E6lboq5Srkh5mD17F0EBdeg,10506
88
88
  torchx/specs/file_linter.py,sha256=QCwob5STTBuy8RsxaevTI-Dk6R8siDJn81LyaOwazes,12333
89
89
  torchx/specs/finder.py,sha256=N8EJcxYmG8ZBreB5FgvufGq-CnNOmvVYUpAdflkv7K8,17312
@@ -115,9 +115,9 @@ torchx/workspace/__init__.py,sha256=FqN8AN4VhR1C_SBY10MggQvNZmyanbbuPuE-JCjkyUY,
115
115
  torchx/workspace/api.py,sha256=PtDkGTC5lX03pRoYpuMz2KCmM1ZOycRP1UknqvNb97Y,6341
116
116
  torchx/workspace/dir_workspace.py,sha256=npNW_IjUZm_yS5r-8hrRkH46ndDd9a_eApT64m1S1T4,2268
117
117
  torchx/workspace/docker_workspace.py,sha256=PFu2KQNVC-0p2aKJ-W_BKA9ZOmXdCY2ABEkCExp3udQ,10269
118
- torchx_nightly-2025.4.19.dist-info/LICENSE,sha256=WVHfXhFC0Ia8LTKt_nJVYobdqTJVg_4J3Crrfm2A8KQ,1721
119
- torchx_nightly-2025.4.19.dist-info/METADATA,sha256=THnyr9KecD675CwBD53vjGkwLTxc34z08VQYxQqFuNg,6167
120
- torchx_nightly-2025.4.19.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
121
- torchx_nightly-2025.4.19.dist-info/entry_points.txt,sha256=T328AMXeKI3JZnnxfkEew2ZcMN1oQDtkXjMz7lkV-P4,169
122
- torchx_nightly-2025.4.19.dist-info/top_level.txt,sha256=pxew3bc2gsiViS0zADs0jb6kC5v8o_Yy_85fhHj_J1A,7
123
- torchx_nightly-2025.4.19.dist-info/RECORD,,
118
+ torchx_nightly-2025.4.21.dist-info/LICENSE,sha256=WVHfXhFC0Ia8LTKt_nJVYobdqTJVg_4J3Crrfm2A8KQ,1721
119
+ torchx_nightly-2025.4.21.dist-info/METADATA,sha256=UHAK6_TXyYuunu4VAu85SjuEsvWP-1doe0097faH7hQ,6167
120
+ torchx_nightly-2025.4.21.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
121
+ torchx_nightly-2025.4.21.dist-info/entry_points.txt,sha256=T328AMXeKI3JZnnxfkEew2ZcMN1oQDtkXjMz7lkV-P4,169
122
+ torchx_nightly-2025.4.21.dist-info/top_level.txt,sha256=pxew3bc2gsiViS0zADs0jb6kC5v8o_Yy_85fhHj_J1A,7
123
+ torchx_nightly-2025.4.21.dist-info/RECORD,,