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: use threading for concurrent requests #133

Merged
merged 5 commits into from
Sep 17, 2024

Conversation

renaudjester
Copy link
Collaborator

@renaudjester renaudjester commented Sep 13, 2024

Gets rid of aiohttp and nest-async

fix: CMT-88, CMT-73, CMT-94


dataset_jsons: list[dict] = await asyncio.gather(
*[
with CatalogParserConnection() as connection:
Copy link
Collaborator

Choose a reason for hiding this comment

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

this also helps to solve some of the warnings in here, no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe, let's check the warnings when we merged everything

@renaudjester renaudjester requested a review from uriii3 September 16, 2024 07:21
Comment on lines +260 to +261
tuple[
tuple[str, str],
Copy link
Collaborator

Choose a reason for hiding this comment

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

so we are now using the default version of tuple from python?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah I like it better I think it's easier than importing the typing hint

) -> list[pathlib.Path]:
(
username,
def _original_files_file_download(
Copy link
Collaborator

Choose a reason for hiding this comment

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

weird name for the function, no? or do you refer to all the original files from the file requested?

@@ -20,7 +19,6 @@ dask = ">=2022"
netCDF4 = ">=1.5.4"
boto3 = ">=1.25"
semver = ">=3.0.2"
nest-asyncio = ">=1.5.8"
Copy link
Collaborator

Choose a reason for hiding this comment

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

hehe <3

@uriii3
Copy link
Collaborator

uriii3 commented Sep 17, 2024

have you noticed or check the behaviour time wise? does it grow the time used or is it more or less the similar? maybe even less? if it increases, is it worth to be able to get rid of nest-asyncio?


def _retry_policy(self, info: RetryInfo) -> RetryPolicyStrategy:
Copy link
Collaborator

Choose a reason for hiding this comment

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

are we getting rid of the retries or is it handled internally somewhere else? the errors seem to be handle another place, but does this mean that we have less control on the behaviour of them?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We are using the requests error retry directly

Yeah I guess a bit less control 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well, not that I like it ee, I feel like it's easier then, so good!

@renaudjester
Copy link
Collaborator Author

have you noticed or check the behaviour time wise? does it grow the time used or is it more or less the similar? maybe even less? if it increases, is it worth to be able to get rid of nest-asyncio?

Yeah I have run some tests and it was very similar times :D

@renaudjester renaudjester merged commit 6a3904e into copernicusmarine-toolbox-v2 Sep 17, 2024
2 checks passed
@renaudjester renaudjester deleted the refactor-async-using branch September 17, 2024 10:40
renaudjester added a commit that referenced this pull request Oct 28, 2024
Not using aiohttp anymore nor nest-asyncio
Also changed from multiprocessing to multi threading for get command
renaudjester added a commit that referenced this pull request Oct 28, 2024
Not using aiohttp anymore nor nest-asyncio
Also changed from multiprocessing to multi threading for get command
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.

2 participants