chore: refactor background tasks processing #2031
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe Your Changes
This pull request introduces significant changes to the
engine
module, focusing on enhancing theModelService
with background task processing capabilities and refactoring estimation handling. Additionally, it includes minor improvements and cleanup in various parts of the codebase.Enhancements to
ModelService
:TaskQueue
to handle background tasks, allowing for efficient processing of model estimations and other asynchronous tasks. (engine/main.cc
[1]engine/services/model_service.cc
[2]engine/services/model_service.h
[3] [4]engine/utils/task_queue.h
[5]ProcessBgrTasks
method to periodically estimate model resource usage and update the internal state. (engine/services/model_service.cc
engine/services/model_service.ccR1409-R1432)Refactoring and cleanup:
ListModel
to provide hardware recommendations for models. (engine/controllers/models.cc
engine/controllers/models.ccL221-R224)GetEstimation
method to separate synchronous and asynchronous estimation handling. (engine/services/model_service.cc
[1]engine/services/model_service.h
[2]HardwareService::Restart
to clean up the output. (engine/services/hardware_service.cc
engine/services/hardware_service.ccL210-L212)Minor improvements:
task_queue.h
inengine/main.cc
to support the new task queue functionality. (engine/main.cc
engine/main.ccR40)engine/services/model_service.cc
[1] [2]Fixes Issues
Self Checklist