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

Check query before fetching data from server #12

Open
fitoprincipe opened this issue Dec 22, 2023 · 4 comments
Open

Check query before fetching data from server #12

fitoprincipe opened this issue Dec 22, 2023 · 4 comments

Comments

@fitoprincipe
Copy link
Member

Problem
Commercial user of GEE API get charged for its usage, so every time a test is triggered, it fetches data from server creating cost for the company. Also, it takes time to fetch data, so when trying to run a complete set of tests, it could take long to finish.

Solution
Save the query string into a file (write/read functionality can be found in geetools) and, when the test is triggered, first check if the query string is the same, if True then skip it, if False then fetch.

Context
The version of GEE python API could be something to consider, since the structure of the query could change from version to version, thus a version check could be implemented. The version should be stored somewhere alongside the query string, so to avoid having to modify the string and for example create a new string/dict with the version code, my proposal is to write it as part of the filename, something like: test_some_method_0-1-384.gee

Probably @tylere could have an opinion on this.

@tylere
Copy link

tylere commented Jan 3, 2024

Assuming that the purpose of pytest-gee is to test packages that use the Earth Engine API (either via the Earth Engine Python client library or REST API), you may want to mock responses of the Earth Engine API so the test run without accessing Earth Engine.
https://pytest-mock.readthedocs.io/en/latest/
https://changhsinlee.com/pytest-mock/

@12rambau
Copy link
Member

12rambau commented Feb 5, 2024

Sorry for not answering earlier but the objective is actually to check the Python API response. The problem we've been facing in the past is small changes made by the GEE behavior without notifying developers. The purpose of the lib here is to really asset the result of the server-side computation.

To provide some context, this plugn is a byproduct of the geetools package that create and manipulate server side object. I really need the response to be evaluate to make sur I'm doing the right thing. I actually got an idea from a colleague on a private repo, I'll try to implement it when I have the time (you'll see it's fancy 😄)

@tylere
Copy link

tylere commented Feb 5, 2024

In this case I would suggest setting up two sets of tests:

  1. A set of fast, inexpensive tests that are run whenever new changes are made to pytest-gee. These tests should use mock data.
  2. A set of slow and/or expensive tests that are run infrequently (for example: daily, weekly, or whenever a new release of pytest-gee is made. These tests would access Earth Engine to detect if the GEE server responses have changed.

@12rambau
Copy link
Member

12rambau commented Feb 6, 2024

ah sure this will be done in downstream packages (geetools, ipygee, pygaul... maybe more ?)

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

No branches or pull requests

3 participants