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

Is support async/await syntax in roadmap or not #74

Open
chenray844 opened this issue Jul 11, 2018 · 2 comments
Open

Is support async/await syntax in roadmap or not #74

chenray844 opened this issue Jul 11, 2018 · 2 comments

Comments

@chenray844
Copy link

@ALL

hi all:
I have read the doc on https://substantic.github.io/rain/docs/index.html.

The example given in get-started as below

from rain.client import Client, tasks, blob

# Connect to server
client = Client("localhost", 7210)

# Create a new session
with client.new_session() as session:

    # Create task (and two data objects)
    task = tasks.Concat((blob("Hello "), blob("world!"),))

    # Mark that the output should be kept after submit
    task.output.keep()

    # Submit all crated tasks to server
    session.submit()

    # Wait for completion of task and fetch results and get it as bytes
    result = task.output.fetch().get_bytes()

    # Prints 'Hello world!'
    print(result)

This is so amusing.

But Python3.5+ support async/await syntax, does this project support this syntax?

in roadmap I find this task Update in the Python API (using aiohttp for async API) (@gavento) [medium]. Is it in order to support `async/await1 syntax?

After supporting async/await syntax, the example maybe shows as below

from rain.client import Client, tasks, blob

# Connect to server
client = Client("localhost", 7210)

# Create a new session
async with client.new_session() as session:

    # Create task (and two data objects)
    task = tasks.Concat((blob("Hello "), blob("world!"),))

    # Mark that the output should be kept after submit
    task.output.keep()

    # Submit all crated tasks to server
    session.submit()

    # Wait for completion of task and fetch results and get it as bytes
    result = await task.output.fetch().get_bytes()

    # Prints 'Hello world!'
    print(result)
@spirali
Copy link
Collaborator

spirali commented Jul 11, 2018 via email

@spirali
Copy link
Collaborator

spirali commented Jul 15, 2018

I have made a quick look on Python3 futures and I do not see how to simply combine futures and capnp promises (however it may still need only few lines of code, but I do not see deep into both). So if someone did not make combination of futures and promises, it has to wait until we did not finish removing of capnp from the client. Nevertheless, async/await API should be definitely part of our API.

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

No branches or pull requests

2 participants