-
Notifications
You must be signed in to change notification settings - Fork 9
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
14 asynchronous requests #15
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual functionality looks great, the organization is a bit entangled (as we discussed) which could be split up more nicely, but I will create a separate issue for that.
The main idea is that the library code has dependencies to other library objects, instead of being composed by the main application, which makes the code more complex than necessary.
results += await asyncio.gather(*[self.annotator.annotate(spectra, jobs, repeat) for spectra in | ||
self.spectrums[size * batch_size:(size + 1) * batch_size]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This operation is quite complex and could either be fit into multiple lines or into a small helper function with a descriptive name.
As discussed, this might then also move to a different class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Please consider implementing requests/minute limits -- we will surely need to throttle this even for testing.
@@ -7,23 +7,23 @@ Repository for tool that adds more annotations (e.g. SMILES, InChI, CAS number) | |||
|
|||
```python | |||
# import MSP class | |||
from libs.MSP import MSP | |||
from libs.Spectra import Spectra |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kudos for updating readme
Asynchronous rework which allows to execute multiple requests simultaneously. This pull requests solves issue #14. This approach was chosen as this is a typical example where program execution is often waiting for response of a request.
Also issue #11 is targeted but not solved, as this approach speeds up the performance. On the other hand, too many requests at once can overload request volume limitations of a service (e.g. PubChem).
Close #14.