You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We use print statements as a way to allow the user to asynchronously return data. Internally, Adama captures stdout from the adapters and generates the streamed response. stdout and print are slow in Python. The proper way to do async responses is using generators (yield statement in Python). This would be much more efficient, but it would increase the complexity of thinking about the code from the user's point of view, as well as testing locally (invoking the search function, for example, would return a generator that has to be exercised, rather than printing the results).
This issue tries to discuss possible approaches:
Leave it as it is.
Use generators.
Support generators and usual prints (it's easy to decide which is which internally). But it still needs to be explained, which makes the docs longer or scarier.
Don't use streaming, just return the full data.
The text was updated successfully, but these errors were encountered:
After discussion with Matt V., we decided to allow prints and generators. Adamalib will include a convenience method to output the data, that will be wired as print for local use, and as generators when deployed in Adama.
We use
print
statements as a way to allow the user to asynchronously return data. Internally, Adama captures stdout from the adapters and generates the streamed response.stdout
andprint
are slow in Python. The proper way to do async responses is using generators (yield
statement in Python). This would be much more efficient, but it would increase the complexity of thinking about the code from the user's point of view, as well as testing locally (invoking thesearch
function, for example, would return a generator that has to be exercised, rather than printing the results).This issue tries to discuss possible approaches:
The text was updated successfully, but these errors were encountered: