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

asynchronously get assets from gee #933

Open
dfguerrerom opened this issue Aug 21, 2024 · 1 comment · Fixed by #934
Open

asynchronously get assets from gee #933

dfguerrerom opened this issue Aug 21, 2024 · 1 comment · Fixed by #934
Assignees
Labels
enhancement New feature or request

Comments

@dfguerrerom
Copy link
Collaborator

dfguerrerom commented Aug 21, 2024

As mentioned in this issue, the AssetSelect component experiences significant delays during loading. This occurs because the sepal_ui.scripts.gee.get_assets function recursively calls the Earth Engine API for each folder at every level. The more folders present, the longer the loading time becomes.

To improve performance, we should implement asynchronous calls to the Earth Engine API to fetch assets more efficiently.

this will also help to improve #870

@dfguerrerom dfguerrerom added the enhancement New feature or request label Aug 21, 2024
@dfguerrerom dfguerrerom self-assigned this Aug 21, 2024
@dfguerrerom dfguerrerom linked a pull request Aug 21, 2024 that will close this issue
@dfguerrerom
Copy link
Collaborator Author

dfguerrerom commented Aug 23, 2024

in #934 I have proposed an asynchronous solution for this problem, however, due to the synchronous naturalness of the earthengine-api there's no way to do fully asynchronous calls in one single thread, that's why there I dispatch threads, which is okaish but not ideal...

I found this nice repository https://github.com/omarryhan/aiogoogle which makes async calls to Google API's, however, earthengine uses a different discovery url, which we cannot use ATM: omarryhan/aiogoogle#147.

That problem can be easily bypassed by manually requesting the discovery document and replacing the GoogleAPI

discovery_document = requests.get("https://earthengine.googleapis.com/$discovery/rest?version=v1").json()
earth_engine_api= GoogleAPI(discovery_document, validate=True)

After that we could just do the requests in the way of earth_engine_api.projects.assets.listAssets(parent=parent)

Last thing to check is the authentication, aiogoogle uses user_creds and client_creds to start the session, and I would like to get them in a transparent way from ee.Initialize(), (if there's a way)

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 a pull request may close this issue.

1 participant