Skip to content

Commit 3a5a9b2

Browse files
Ritesh1905meta-codesync[bot]
authored andcommitted
Pass appdef metadata to ServerSpec in monarch commands.info() (#1671)
Summary: Pull Request resolved: #1671 This change ensures that metadata from the AppDef is propagated to the ServerSpec object returned by the info() function. Reviewed By: moonli Differential Revision: D85579216 fbshipit-source-id: 208205c32f16d60b8afb97dd045478cd3d373756
1 parent c758e7a commit 3a5a9b2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

python/monarch/tools/commands.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def info(server_handle: str) -> Optional[ServerSpec]:
211211
scheduler=scheduler,
212212
namespace=namespace,
213213
ui_url=status.ui_url,
214+
metadata=appdef.metadata,
214215
)
215216

216217

python/tests/tools/test_commands.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ def replica_status(idx: int, hostname: str) -> ReplicaStatus:
175175
image="__unused__",
176176
)
177177
],
178+
metadata={
179+
"monarch/meshes/trainer/host_type": "gpu.medium",
180+
"monarch/meshes/trainer/gpus": "2",
181+
},
178182
),
179183
server_info,
180184
)
@@ -183,6 +187,14 @@ def replica_status(idx: int, hostname: str) -> ReplicaStatus:
183187
assert server_info
184188
self.assertEqual("node_d", server_info.host0("trainer"))
185189

190+
# verify metadata is correctly passed through
191+
self.assertIn("monarch/meshes/trainer/host_type", server_info.metadata)
192+
self.assertEqual(
193+
server_info.metadata["monarch/meshes/trainer/host_type"], "gpu.medium"
194+
)
195+
self.assertIn("monarch/meshes/trainer/gpus", server_info.metadata)
196+
self.assertEqual(server_info.metadata["monarch/meshes/trainer/gpus"], "2")
197+
186198

187199
UNUSED = "__UNUSED__"
188200
_5_MS = timedelta(milliseconds=5)

0 commit comments

Comments
 (0)