Skip to content

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

Description

@chenray844

@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)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions