This PR introduces refactoring of the ImageRequestHandler and RegionRequestHandler classes to decouple them from ModelRunner. The handlers now accept their necessary dependencies through their constructors, making them self-contained, modular, and easier to test. Additionally, changes to the ModelRunner class were made to initialize these handlers with the appropriate dependencies.
Key Changes:
Decoupled ImageRequestHandler from ModelRunner:
ImageRequestHandler now takes in the following dependencies via its constructor:
Issue #, if available: n/a
WIP
Notes
This PR introduces refactoring of the
ImageRequestHandler
andRegionRequestHandler
classes to decouple them fromModelRunner
. The handlers now accept their necessary dependencies through their constructors, making them self-contained, modular, and easier to test. Additionally, changes to theModelRunner
class were made to initialize these handlers with the appropriate dependencies.Key Changes:
Decoupled
ImageRequestHandler
fromModelRunner
:ImageRequestHandler
now takes in the following dependencies via its constructor:job_table
,image_status_monitor
,endpoint_statistics_table
tiling_strategy
,region_request_queue
,region_request_table
endpoint_utils
,config
ModelRunner
instance and improves modularity.Decoupled
RegionRequestHandler
fromModelRunner
:RegionRequestHandler
now takes in its own initialization parameters:region_request_table
,job_table
,region_status_monitor
,endpoint_statistics_table
tiling_strategy
,region_request_queue
,endpoint_utils
,config
ModelRunner
, allowing for cleaner design and unit testing.Updated
ModelRunner
to Inject Dependencies:ModelRunner
now constructs and passes all required dependencies to bothImageRequestHandler
andRegionRequestHandler
.Improved Modular Design and Testability:
Renamed
app.py
and app_config`` filesapp.py
tomodel_runner.py
app_config.py
toconfig.py
Checklist
Before you submit a pull request, please make sure you have the following:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.