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

Processor: Allow client to specify progress callback function #128

Merged
merged 5 commits into from
Jul 26, 2024

Conversation

dbaston
Copy link
Member

@dbaston dbaston commented Jun 27, 2024

No description provided.

Copy link

codecov bot commented Jun 27, 2024

Codecov Report

Attention: Patch coverage is 86.56716% with 18 lines in your changes missing coverage. Please review.

Project coverage is 90.73%. Comparing base (5cfeff2) to head (6b4dde4).
Report is 3 commits behind head on master.

Files Patch % Lines
python/src/exactextract/exact_extract.py 55.00% 9 Missing ⚠️
src/utils_cli.cpp 0.00% 3 Missing ⚠️
src/feature_sequential_processor.cpp 89.47% 2 Missing ⚠️
src/processor.h 77.77% 2 Missing ⚠️
python/src/exactextract/feature.py 87.50% 1 Missing ⚠️
src/exactextract.cpp 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #128      +/-   ##
==========================================
+ Coverage   90.52%   90.73%   +0.20%     
==========================================
  Files          85       85              
  Lines        6082     6176      +94     
  Branches      611      611              
==========================================
+ Hits         5506     5604      +98     
+ Misses        544      540       -4     
  Partials       32       32              

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

@JakubCha
Copy link
Contributor

Hello Dan. I don't know if it's the correct place to ask. I can move it to issues if preferred.
Do you plan to expose this functionality to Python API? I'd make use of this in the QGIS plugin as right now I have no way of reporting to user progress of calculating stats.

@dbaston
Copy link
Member Author

dbaston commented Jul 25, 2024

Yes, I would expose it to Python. I am wondering if I should also extend it to directly provide a progress percentage.

@JakubCha
Copy link
Contributor

JakubCha commented Jul 25, 2024

It would be nice to have that as well. I wonder how it would work in Python API.

  • in the case of feature-sequential it would make a call to callback function every time the feature is calculated
  • raster-sequential - make callback for each chunk is calculated

Am I thinking about it correctly?

@dbaston
Copy link
Member Author

dbaston commented Jul 25, 2024

@JakubCha Currently yes, the progress callback is invoked either once per feature or once per raster chunk. In the per-chunk case, the caller has no simple way to know how many chunks there will be, so I've updated the progress bar to take two arguments: the fraction completed, and an informational message. This would also allow providing more frequent progress updates when a feature needs to subdivided to limit memory usage, or when a raster chunk has many intersecting features.

@dbaston dbaston merged commit 2cb8c96 into isciences:master Jul 26, 2024
21 of 22 checks passed
@dbaston dbaston added the enhancement New feature or request label Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants