Skip to content

How to use context.run(asynchronous=True) for many tasks #892

Description

@adamcunnington-mlg

Hi, a usage question as the docs are quite lite on this topic.

If I want to make 5 context.run() calls concurrently but I don't want to complete execution of my function until they have all finished, is there something more elegant than this:

class AggregateError(Exception): 
    pass

running = [context.run(foo, async=True), context.run(bar, async=True), context.run(baz, async=True)]

while running:
    for promise, index in enumerate(running[:]):
        ....

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