Repeated post tasks aren't correctly ordered
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by reproducing the issue with the Python task definitions in the report and inspect Invoke's task execution and pre/post-task ordering logic. Done means the shared post task runs only once, after the last task that declares it, producing the expected output.
Written by the indexing model from the issue text.
Description
Description
When I set a post task on multiple tasks Invoke correctly only executes it once. But it is executed after the first task that has it as a post task, instead of waiting until the last task is done which has the task as post task.
Code
import invoke
@invoke.task
def post_task(_: invoke.Context) -> None:
print('The last task')
@invoke.task(post=[post_task])
def pre_task_1(_: invoke.Context) -> None:
print('The first pre task')
@invoke.task(post=[post_task])
def pre_task_2(_: invoke.Context) -> None:
print('The second pre task')
@invoke.task(default=True, pre=[pre_task_1, pre_task_2], post=[post_task])
def main(ctx: invoke.Context) -> None:
print('The main task')
Expected output
The first pre task
The second pre task
The main task
The last task
Output result
The first pre task
The last task
The second pre task
The main task
Additional information
- Invoke 2.2.0
- Python 3.11.6
- Dominant language
- Python
- Stars
- 4.8k
- Forks
- 412
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pyinvoke/invoke
-
[Security] Shell injection via Context.cd() path argument — metacharacters not escaped (CWE-78) Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Similar issues
-
bug priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
CyberAgent/psd2svg#436 ·
-
area/install-update comp/cli comp/desktop P3 sweeper:risk-compatibility type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
NousResearch/hermes-agent#122386 · 1 comment ·
-
ai-generated
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/production-stack#1105 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100