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

feat: replacing incron with a specific script #8234

Merged
merged 5 commits into from
Mar 31, 2023
Merged

Conversation

alexgarel
Copy link
Member

Replaces incron with a specific script.

Fixes:

@alexgarel
Copy link
Member Author

I would like to add some integration test. But it should be reviewable @stephanegigandet

@github-advanced-security
Copy link

You have successfully added a new SonarCloud configuration ``. As part of the setup process, we have scanned this repository and found no existing alerts. In the future, you will see all code scanning alerts on the repository Security tab.

@github-actions github-actions bot added the 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies label Mar 21, 2023
@codecov-commenter
Copy link

codecov-commenter commented Mar 21, 2023

Codecov Report

Merging #8234 (dddb73d) into main (bda3722) will increase coverage by 0.30%.
The diff coverage is 76.47%.

@@            Coverage Diff             @@
##             main    #8234      +/-   ##
==========================================
+ Coverage   47.06%   47.37%   +0.30%     
==========================================
  Files         104      105       +1     
  Lines       20449    20563     +114     
  Branches     4650     4656       +6     
==========================================
+ Hits         9624     9741     +117     
+ Misses       9678     9670       -8     
- Partials     1147     1152       +5     
Impacted Files Coverage Δ
lib/ProductOpener/Test.pm 37.43% <7.69%> (-2.23%) ⬇️
lib/ProductOpener/Images.pm 10.14% <52.94%> (+3.54%) ⬆️
tests/unit/send_image_to_cloud_vision.t 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@@ -266,7 +266,7 @@ sub ensure_expected_results_dir ($expected_results_dir, $update_expected_results
return 1;
}

=head2 compare_to_expected_results($object_ref, $expected_results_file, $update_expected_results) {
=head2 compare_to_expected_results($object_ref, $expected_results_file, $update_expected_results, $test_ref = undef) {
Copy link
Contributor

Choose a reason for hiding this comment

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

$test_ref is currently not used

Copy link
Member Author

@alexgarel alexgarel Mar 22, 2023

Choose a reason for hiding this comment

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

it will be used when I merge data quality knowledge panels :-D

{
features => [
{type => 'TEXT_DETECTION'},
{type => 'LOGO_DETECTION'},
Copy link
Contributor

Choose a reason for hiding this comment

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

for cropped images for ingredients and nutrition, we just need the text detection, maybe we could add an extra parameter to send_image_to_cloud_vision() so that we can state which detection we want.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, I see, I though it was not intended (as code was duplicated).

Copy link
Contributor

Choose a reason for hiding this comment

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

We pay for each type of detection, so if we just need the text, then we should remove the others (which have been done on the full uncropped image already)

Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

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

Looks good to me

* also add cloud vision url as a parameter
@github-actions github-actions bot added config 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 🐾 Open Pet Food Facts Our pet food analysis project https://world.openpetfoodfacts.org 📸 Open Products Facts Our project to increase the lifespan of objects. https://world.openproductsfacts.org labels Mar 23, 2023
@sonarcloud
Copy link

sonarcloud bot commented Mar 23, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@@ -84,6 +84,10 @@ requires 'Log::Any::Adapter::Log4perl', '>= 0.09'; # liblog-any-adapter-log4perl
requires 'Action::CircuitBreaker';
requires 'Action::Retry'; # deps: libmath-fibonacci-perl

# AnyEvent
Copy link
Contributor

Choose a reason for hiding this comment

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

what about the EV module?

Copy link
Member Author

Choose a reason for hiding this comment

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

AnyEvent brings the INotify module. There is no direct integration with EV.

AnyEvent is an abstraction, EV is the event implementation layer. So we need both.

@@ -634,4 +640,74 @@ sub normalize_mail_for_comparison ($mail) {
return \@lines;
}

=head2 fake_http_server($port, $dump_path, $responses_ref) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome!

Copy link
Contributor

Choose a reason for hiding this comment

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

I second Stèphane, Awesome!

@alexgarel alexgarel merged commit 982d1bf into main Mar 31, 2023
@alexgarel alexgarel deleted the feat-incron-replace branch March 31, 2023 13:34
@alexgarel
Copy link
Member Author

@stephanegigandet I merged this, but it means you should change the setup in production ! (remove incron task, and add a systemd entry for this new script)

@stephanegigandet
Copy link
Contributor

@alexgarel I'll wait until Monday ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config 🖼️ Images OCR 🧴 Open Beauty Facts Our cosmetic analysis project https://world.openbeautyfacts.org 🐾 Open Pet Food Facts Our pet food analysis project https://world.openpetfoodfacts.org 📸 Open Products Facts Our project to increase the lifespan of objects. https://world.openproductsfacts.org 🧬 Taxonomies https://wiki.openfoodfacts.org/Global_taxonomies 🧪 tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants