Open wassupxP opened 1 year ago
Please include a minimal dodo.py
that reproduces the problem.
Hi, it is a bit nasty, but you should be able to reproduce the issue from it. Run on doit 0.35.0
import os
def task_parent():
curr_file = os.path.dirname(os.path.abspath(__file__))
def action():
with open(os.path.join(curr_file, "file.txt"), "w+") as f:
f.write("MOCK")
return {'actions': [(action,)],
'uptodate': [os.path.isfile(os.path.join(curr_file, "file.txt"))],
'basename': 'parent',
'task_dep': ["child"]
}
def task_child2():
curr_file = os.path.dirname(os.path.abspath(__file__))
def action():
with open(os.path.join(curr_file, "file2.txt"), "w+") as f:
f.write("MOCK")
return {'actions': [(action,)],
'uptodate': [os.path.isfile(os.path.join(curr_file, "file2.txt"))],
'basename': 'child',
}
Including also console log
$ ls
__pycache__/ dodo.py share/
$ python.exe -m doit parent
. child
. parent
$ ls
__pycache__/ dodo.py file.txt file2.txt share/
$ rm file2.txt
$ python.exe -m doit info parent
parent
status : up-to-date
task_dep :
- child
$ python.exe -m doit info child
child
status : run
* The following uptodate objects evaluate to false:
- False (args=None, kwargs=None)
Please let me know if you need additional info.
If you execute again the output would be:
. child
- parent
So the parent
is really up-to-date.
A task-dependency only indicates that another task should be “executed” before itself. [1] I don't know how to make this more clear in the docs... I will add a FAQ because it is a common misconception.
@schettino72 Can I ask why the up-to-date state isn't propagated? Have you considered adding this feature? Since it's a common "misconception", it's probably a behavior that is illogical and unexpected by most users who encounter it.
If you execute again the output would be:
. child - parent
So the
parent
is really up-to-date.A task-dependency only indicates that another task should be “executed” before itself. [1] I don't know how to make this more clear in the docs... I will add a FAQ because it is a common misconception.
Thanks for info. Well this behavior is easily overridable, just wanted to report it. But from my point of view, if task depends on another task, its final state should be also dependent on state of child task. Thanks for explanation and sorry for wasting your time. FAQ section will surely help plenty of other users! :)
But from my point of view, if task depends on another task, its final state should be also dependent on state of child task.
Well, that's your use case. The system was designed so its core concepts are orthogonal. This gives more flexibility in the long run.
You could repeat the same "file_dep" in the parent
task.
Or you probable want to use a result_dep
[1]
[1] https://pydoit.org/uptodate.html?highlight=result_dep#result-dependency
Issue: After version bump I found out, that tasks are uptodate even though some of their task_deps are not. Only subtask is rebuilt afterwards and not whole tree to the parent
Not sure whether this was intentional or really a bugfix.
Workaround: In task_loader inject True or False to "uptodate" for each task in task_deps, depending on status of dependent task.
Environment
Let me know if additional informations or sth is needed.