lablup / lablup/backend.ai

Refactor `create_kernels` RPC call to asynchronous event-driven pattern

Open
#2,953 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
670
Forks
183
Avg merge
17h 7m
Merged PRs (30d)
358

Description

## Current Behavior

The "manager" component makes a RPC call `create_kernels` to "agent" components. The manager blocks and waits for the RPC response from agents, which:Creates tight coupling between managers and agentsIncreases latency as managers must wait for kernel creation completion

## Proposed Changes

Refactor the `create_kernels` RPC function to use a fire-and-forget pattern with event-based result handling:

1. Manager component:
- Implement event subscription to receive kernel creation failure (managers are already handling creation success events).
1. Agent component:
- Modify `create_kernels` RPC handler to spawn background coroutine tasks
- Return response in `create_kernels` RPC function immediately
- Add error handling and dispatch kernel creation failure events

JIRA Issue: BA-77

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.