Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor engine #194

Closed
wants to merge 30 commits into from
Closed

Refactor engine #194

wants to merge 30 commits into from

Conversation

MateoLostanlen
Copy link
Member

@MateoLostanlen MateoLostanlen commented May 20, 2024

Refactoring for PTZ Camera Integration

I propose a refactor of the code to prepare for the use of PTZ cameras, which is divided into two features:

Feature 1: New ReolinkCamera

This new ReolinkCamera class allows control of both PTZ cameras and the current static cameras.

Feature 2: Parallel Processing

In the previous version of the engine, a 30-second loop would allocate 30 seconds / (number of cameras) per camera to perform three tasks:

  • Image capture
  • Prediction calculation
  • Processing the prediction and sending images in case of alerts

The problem was that in some cases, the image sending failed due to a lack of time. Additionally, this method does not scale well with a larger number of cameras, which will be the case with PTZ cameras that have a smaller field of view.

I propose to launch three parallel processes to manage these steps independently, optimizing the calculations as much as possible.

The code has been tested and works without any issues.

Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 84.68468% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 89.41%. Comparing base (45b19e0) to head (511864c).

Files Patch % Lines
pyroengine/core.py 81.95% 24 Missing ⚠️
pyroengine/sensors.py 89.61% 8 Missing ⚠️
pyroengine/engine.py 83.33% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #194      +/-   ##
===========================================
+ Coverage    87.92%   89.41%   +1.48%     
===========================================
  Files            6        6              
  Lines          381      548     +167     
===========================================
+ Hits           335      490     +155     
- Misses          46       58      +12     
Flag Coverage Δ
unittests 89.41% <84.68%> (+1.48%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MateoLostanlen MateoLostanlen mentioned this pull request May 20, 2024
@MateoLostanlen
Copy link
Member Author

I will create a new PR

@MateoLostanlen MateoLostanlen deleted the refactor_engine branch June 21, 2024 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant