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

Help wanted for testing async support #4

Open
Technologicat opened this issue Jul 24, 2019 · 3 comments
Open

Help wanted for testing async support #4

Technologicat opened this issue Jul 24, 2019 · 3 comments
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@Technologicat
Copy link
Owner

Help wanted!

The interaction between unpythonic and the async stuff that was added in Python 3.5 is totally untested, because I haven't used, and I'm not even that familiar with, that part of Python myself.

Reading Brett Cannon's explanation, I surmise the async features are intended mainly for "microthreading" typical server loads, which mostly wait on I/O, but must scale to thousands of simultaneous requests. Coming from numerical background where the load is practically always CPU- or memory-bound, I haven't found much use for such constructs, since there the GIL makes them uninteresting. Multiprocessing, Cython + OpenMP, or MPI, exactly one task per core, done.

So, discussion and test cases are more than welcome!

If interested, please post a comment here, or open a PR if you have some tests you'd like to suggest. See directories unpythonic/test and unpythonic/syntax/test for examples. (Any test modules in these directories are autodetected by runtests.py.)

Note that I have absolutely no idea in which kind of use cases unpythonic and async would appear together - that is exactly why this is help wanted.

If you have such a use case and especially if it doesn't work, please share!

(As of 0.14.1, the current level of async support in unpythonic is a blind guess. The macros recognize the AST nodes for the async stuff, but since I'm not quite sure what should be done with them, they try to do something similar as to the same "basic" (no async) node. Needless to say, there are probably bugs.)

@Technologicat Technologicat added bug Something isn't working enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jul 24, 2019
@Technologicat Technologicat changed the title Test and debug async support Help test async support Jul 24, 2019
@Technologicat Technologicat changed the title Help test async support Help wanted for testing async support Jul 25, 2019
@Technologicat
Copy link
Owner Author

Technologicat commented Jul 25, 2019

Linking to the relevant PEP. Maybe this one too.

@Technologicat Technologicat added this to the far-future milestone Aug 8, 2019
@Technologicat
Copy link
Owner Author

Having done some frontend coding in the meantime, I now have a fairly good understanding of what async/await do, but this is not a high priority for unpythonic. Help is still welcome.

On the topic of async concurrency, Trio looks interesting. See also the original blog post on Trio by its author, Nathaniel Smith.

@Technologicat
Copy link
Owner Author

  • At least continuations needs an await when it calls into the continuation it extracted, if the continuation is an async function.
  • Also tail calls into async continuations should be awaited. This may be difficult to do, since we don't currently keep track of the type of each function (and sometimes this information is not lexically available).
    • Maybe add a runtime wrapper: return await f(...) if iscoroutine(f) else f(...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant