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

Consider more advanced constructs in user's code #82

Open
waltermoreira opened this issue Jul 23, 2015 · 1 comment
Open

Consider more advanced constructs in user's code #82

waltermoreira opened this issue Jul 23, 2015 · 1 comment

Comments

@waltermoreira
Copy link
Contributor

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.
@waltermoreira
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant