Skip to content

Commit

Permalink
Fix list_children
Browse files Browse the repository at this point in the history
  • Loading branch information
oeway committed Oct 28, 2024
1 parent 666c002 commit 9406af4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions hypha/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ async def setup_applications_collection(self, overwrite=True, context=None):
"config",
"services",
],
"collection": [],
}
await self.artifact_manager.create(
"applications", manifest, overwrite=overwrite, stage=False, context=context
Expand Down Expand Up @@ -520,12 +519,15 @@ async def list_running(self, context: Optional[dict] = None) -> List[str]:
async def list_apps(self, context: Optional[dict] = None):
"""List applications in the workspace."""
try:
apps = await self.artifact_manager.read(
apps = await self.artifact_manager.list_children(
prefix="applications", context=context
)
return apps["collection"]
return apps
except KeyError:
return []
except Exception as exp:
logger.exception("Failed to list apps: %s", exp)
return []

async def close(self) -> None:
"""Close the app controller."""
Expand Down
4 changes: 2 additions & 2 deletions hypha/core/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -1248,12 +1248,12 @@ async def _launch_application_for_service(
"built-in",
], f"Invalid service id: {service_id}"

app_collection = await self._artifact_manager.read(
applications = await self._artifact_manager.list_children(
"applications", context={"ws": workspace, "user": user_info.model_dump()}
)
applications = {
item["id"]: ApplicationArtifact.model_validate(item)
for item in app_collection["collection"]
for item in applications
}
if app_id not in applications:
raise KeyError(
Expand Down

0 comments on commit 9406af4

Please sign in to comment.