pytask-dev/pytask

BUG: task appears duplicated

Closed this issue · 3 comments

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of pytask.
  • (optional) I have confirmed this bug exists on the main branch of pytask.

Code Sample, a copy-pastable example

produces = {"foo": OUT_TABLES / "foo.tex"}


@pytask.mark.task()
def task_foo(
    produces=produces,
):
    with open(produces["foo"], "w") as my_table:
        my_table.write("")

Problem description

This minimal example produces the following error:

──────────────────────────────────────── Failures during resolving dependencies ────────────────────────────────────────

ResolvingDependenciesError: There are some tasks which produce the same output. See the following tree which shows which
products are produced by multiple tasks.

Products from multiple tasks:
└── 📄 microsim/out/tables/foo.tex
    ├── 📝 task_visualize_logit_results.py::task_foo[produces0]
    └── 📝 task_visualize_logit_results.py::task_foo[produces1]
    

The error does not occur if I include an id: @pytask.mark.task(id="id")

Hi @ChristianZimpelmann,

thanks for raising the issue! I changed your example to

import pytask
from pathlib import Path


produces = {"foo": Path(__file__).parent / "foo.tex"}


@pytask.mark.task
def task_foo(
    produces=produces,
):
    with open(produces["foo"], "w") as my_table:
        my_table.write("")

and it works just fine. Can you confirm? I do not think that I altered it in a way that should prevent reproducibility of the bug. If the example also works for you, is there anything else special about your case?

Thanks, @tobiasraabe, for improving my example!

I indeed get no error with the example. Also, strangely I cannot reproduce the error anymore in my code and my "minimal example".

I am not sure what went wrong yesterday. I think we can close the issue for now.

Ok, let's close it. Feel free to reopen it if the issue resurfaces.