Skip to content

AsyncIO compatibility #4

Description

@gaboose

Running an Owyl tree and something else concurrently in the same application is only possible with threading right now.

There is a safer and more modern alternative - asyncio, which is in the standard library. Lots of libraries are already compatible with it. This can also be a good time to upgrade Owyl to Python3.

It helps a lot that Asyncio's code patterns are very similar to Owyl's:

@owyl.parent_task
def sequence(*children, **kwargs):
    final_value = True
    for child in children:
        result = yield child(**kwargs)
        if not result and result is not None:
            final_value = False
            break
    yield final_value

@asyncio.coroutine
def sequence(*children, **kwargs):
    for coroutine in children:
        result = yield from coroutine(**kwargs)
        if not result:
            return False
    return True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions