Skip to content

Out of order dependencies lead to exception #146

Open
@mebenstein

Description

@mebenstein

Tutorial 1 mentions:

Tasks can be spawned out of order. A tasks dependencies do not need to have been before being listed through the TaskSpace.

When I tried the following:

from parla import Parla
from parla.tasks import spawn, TaskSpace
from parla.cpu import cpu

if __name__ == "__main__":
    print("start")
    with Parla():
        @spawn(placement=cpu)
        async def main_task():
            t = TaskSpace("tasks")

            @spawn(t[1], dependencies=[t[0]],placement=cpu)
            def b():
                print("b")

            @spawn(t[0],placement=cpu)
            def a():
                print("a")


            await t

I get:

ValueError: ('dependent task %s should have been spawned', 'TaskID(tasks_1, task=None)')

Which is caused by the following assertion in task_runtime.py:
if dependent.task is None

It seems that this assertion makes no sense since ComputeTask is only invoked after all the unspawned dependencies are supposed to be added. Thus this assertion can never be true, maybe it should be removed?

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions