diff --git a/torchx/runner/api.py b/torchx/runner/api.py index e63f7a2fd..922aca539 100644 --- a/torchx/runner/api.py +++ b/torchx/runner/api.py @@ -597,7 +597,7 @@ def describe(self, app_handle: AppHandle) -> Optional[AppDef]: if not app: desc = scheduler.describe(app_id) if desc: - app = AppDef(name=app_id, roles=desc.roles) + app = AppDef(name=app_id, roles=desc.roles, metadata=desc.metadata) return app def log_lines( diff --git a/torchx/runner/test/api_test.py b/torchx/runner/test/api_test.py index 616987b04..c29ee35c9 100644 --- a/torchx/runner/test/api_test.py +++ b/torchx/runner/test/api_test.py @@ -440,6 +440,7 @@ def build_workspace_and_update_role( def test_describe(self, _) -> None: with self.get_runner() as runner: + metadata = {"a": "b", "c": "d"} role = Role( name="sleep", image=str(self.tmpdir), @@ -447,7 +448,7 @@ def test_describe(self, _) -> None: entrypoint="sleep", args=["60"], ) - app = AppDef("sleeper", roles=[role]) + app = AppDef("sleeper", roles=[role], metadata=metadata) app_handle = runner.run(app, scheduler="local_dir", cfg=self.cfg) self.assertEqual(app, runner.describe(app_handle)) diff --git a/torchx/schedulers/api.py b/torchx/schedulers/api.py index 4d357fe0d..80397c95a 100644 --- a/torchx/schedulers/api.py +++ b/torchx/schedulers/api.py @@ -43,7 +43,7 @@ class DescribeAppResponse: the status and description of the application as known by the scheduler. For some schedulers implementations this response object has necessary and sufficient information to recreate an ``AppDef`` object. For these types - of schedulers, the user can re-``run()`` the recreted application. Otherwise + of schedulers, the user can re-``run()`` the recreated application. Otherwise the user can only call non-creating methods (e.g. ``wait()``, ``status()``, etc). @@ -61,6 +61,7 @@ class DescribeAppResponse: msg: str = NONE structured_error_msg: str = NONE ui_url: Optional[str] = None + metadata: dict[str, str] = field(default_factory=dict) roles_statuses: List[RoleStatus] = field(default_factory=list) roles: List[Role] = field(default_factory=list)