Skip to content

Conversation

@A-Artemis
Copy link
Contributor

@A-Artemis A-Artemis commented Feb 9, 2026

Summary

The emitted event is now handled, and the model is reloaded with the desired inference device.

How to test

Start an inference pipeline, check the logs:

2026-02-10 11:32:30.270 | INFO | model_api.adapters.openvino_adapter:load_model:240 - The model data/projects/9d6af8e8-6017-4ebe-9126-33aae739c5fa/models/977eeb18-eaac-449d-bc80-e340fbe052ad/model.xml is loaded to CPU

Change the device:

curl -s -X PATCH localhost:7860/api/projects/${PROJECT_ID}/pipeline -H "Content-Type: application/json" --data '{"device": "xpu-0"}'

Check the logs again:

2026-02-10 11:32:45.835 | INFO | model_api.adapters.openvino_adapter:load_model:240 - The model data/projects/9d6af8e8-6017-4ebe-9126-33aae739c5fa/models/977eeb18-eaac-449d-bc80-e340fbe052ad/model.xml is loaded to GPU.0

Checklist

  • The PR title and description are clear and descriptive
  • I have manually tested the changes
  • All changes are covered by automated tests
  • All related issues are linked to this PR (if applicable)
  • Documentation has been updated (if applicable)

@A-Artemis A-Artemis self-assigned this Feb 9, 2026
@github-actions github-actions bot added TEST Any changes in tests Geti Tune Backend Issues related to Geti Tune backend labels Feb 9, 2026
@A-Artemis A-Artemis requested a review from Copilot February 9, 2026 15:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for selecting an inference device and ensures the model reloads when the device changes.

Changes:

  • Extend model activation / loaded model state to include an inference device.
  • Trigger model reload on INFERENCE_DEVICE_CHANGED events (including new unit coverage).
  • Reload the inference model when the configured device differs from the currently loaded one.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
application/backend/app/models/model_activation.py Adds device to persisted activation state.
application/backend/app/services/active_model_service.py Loads device from active pipeline and reloads model when device changes.
application/backend/app/services/event/event_bus.py Emits model-reload signal on inference device change.
application/backend/app/workers/dispatching.py Subscribes dispatching worker to inference device change event.
application/backend/app/repositories/active_model_repo.py Adds DB query for active pipeline’s configured device.
application/backend/tests/unit/services/test_active_model_service.py Asserts LoadedModel.device matches activation state.
application/backend/tests/unit/services/event/test_event_bus.py Adds test ensuring device-change triggers model reload.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

📊 Test coverage report

Metric Coverage
Lines 34.7%
Functions 74.1%
Branches 88.3%
Statements 34.7%

@github-actions
Copy link

github-actions bot commented Feb 9, 2026

Docker Image Sizes

CPU

Image Size
geti-tune-cpu:pr-5478 2.97G
geti-tune-cpu:sha-06d3032 2.97G

GPU

Image Size
geti-tune-gpu:pr-5478 10.95G
geti-tune-gpu:sha-06d3032 10.95G

XPU

Image Size
geti-tune-xpu:pr-5478 9.76G
geti-tune-xpu:sha-06d3032 9.76G

@A-Artemis A-Artemis marked this pull request as ready for review February 10, 2026 11:12
@A-Artemis A-Artemis requested a review from a team as a code owner February 10, 2026 11:12
Copy link
Contributor

@leoll2 leoll2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, preferably ask for an additional review since I pushed some changes myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Geti Tune Backend Issues related to Geti Tune backend TEST Any changes in tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inference model is always loaded on CPU instead of the selected device

2 participants