-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Add background-task for kernel-pull-progress #477
base: main
Are you sure you want to change the base?
feat: Add background-task for kernel-pull-progress #477
Conversation
022c866
to
c4a8e16
Compare
9801126
to
6322ca5
Compare
6322ca5
to
38c3f51
Compare
Codecov Report
@@ Coverage Diff @@
## main #477 +/- ##
=======================================
Coverage 48.89% 48.89%
=======================================
Files 54 54
Lines 8908 8908
=======================================
Hits 4356 4356
Misses 4552 4552 Continue to review full report at Codecov.
|
4b5c9cd
to
b5deb3a
Compare
|
||
task_id = await root_ctx.background_task_manager.start( | ||
kernelpullprogress, | ||
name='kernel-pull-progress' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name='kernel-pull-progress' | |
name='kernel-pull-progress', |
I have finished to fix the code reflected your feedback. Also, the code in client-py is fixed. Formally, I don't check 'background_task'. After fixed, I check 'background_task'. If true, kernel-pull-progress is displayed to client during pulling(downloading image). If not, client can't see the progress and wait it. |
Just a note: Formally -> Formerly / Previously |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more minor fixes please!
05f19e0
to
45026a2
Compare
45026a2
to
e150d63
Compare
…nto feature/select-and-update-kernelpullprogress
@@ -513,7 +515,62 @@ async def _create(request: web.Request, params: Any) -> web.Response: | |||
resp['servicePorts'] = [] | |||
resp['created'] = True | |||
|
|||
if not params['enqueue_only']: | |||
async def monitor_kernel_preparation(reporter: ProgressReporter) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we extract this as a separate function for better testability? (Let's avoid too much nested functions!)
I have no idea how to send some data(e.g, kernel_id, root_ctx, ...) to this as separate function . So, I change this to callable class and separate this from '_create' function. |
Callable class is generally considered an anti-pattern unless you are writing a kind of low-level library. |
To handle multi-node scenarios (cluster sessions) where multiple agents generate the same |
To implement this in the client-side, we need to:
To implement this in the manager-side:
Personally, I think it's better to implement in the client side, as depending on the client-side implementation, we would have runtime options whether to expose more per-kernel details or show the overall progress only. |
Sorry for the late reply.
And, if we implement the multi scenario in the client-side, is there no need to fix it anymore? |
refs backend.ai-issue#227
About Background-Task
The bgtask contains two asynchronous functions, one of them selects kernel's status from 'kernels' table, the other updates progress.
To ensure synchronization, I use Asyncio-lock.Update_progress function updates progress status, reacting to KernelPullprogress Event. And, Progress Reporter is updated by the function. So, manager sends the progress-reporter to client, and, client displays kernel-pull-progress using the reporter.