Skip to content

Commit

Permalink
feature: Pass Root context of manager to plugins (#1829)
Browse files Browse the repository at this point in the history
Co-authored-by: Joongi Kim <[email protected]>
  • Loading branch information
fregataa and achimnol authored Jan 18, 2024
1 parent b052e29 commit 4461215
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/1829.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pass the root context to the manager plugins so that they can access database connection pools and other globals
3 changes: 2 additions & 1 deletion src/ai/backend/manager/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ async def webapp_plugin_ctx(root_app: web.Application) -> AsyncIterator[None]:
root_ctx: RootContext = root_app["_root.context"]
plugin_ctx = WebappPluginContext(root_ctx.shared_config.etcd, root_ctx.local_config)
await plugin_ctx.init(
context=root_ctx,
allowlist=root_ctx.local_config["manager"]["allowed-plugins"],
blocklist=root_ctx.local_config["manager"]["disabled-plugins"],
)
Expand Down Expand Up @@ -439,7 +440,7 @@ async def hook_plugin_ctx(root_ctx: RootContext) -> AsyncIterator[None]:
ctx = HookPluginContext(root_ctx.shared_config.etcd, root_ctx.local_config)
root_ctx.hook_plugin_ctx = ctx
await ctx.init(
context=ctx,
context=root_ctx,
allowlist=root_ctx.local_config["manager"]["allowed-plugins"],
blocklist=root_ctx.local_config["manager"]["disabled-plugins"],
)
Expand Down

0 comments on commit 4461215

Please sign in to comment.