Skip to content

Feature Request: task.ensure_future or task.create_task #112

Closed
@dlashua

Description

@dlashua

I would like a way to say "run this other pyscript method without blocking execution of the current code path". Even better if this new method returns some kind of Future-like object that I can, later, get the result of, or cancel, or whatever. This method should take a pyscript method as an argument:

So I can, for instance do :

for value in range(4):
  task.create_task(report_a)

def report_a():
  task.unique('report_a')
  task.sleep(10)
  log.info('reporting a')

When running this, the log.info should only happen once and it should only sleep for 10-ish seconds.

Even better if I can pass arguments too: task.create_task(report_a, param1, param2, other="thing")

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