SergiyKolesnikov
SergiyKolesnikov

Reputation: 7815

How to disable dependencies deduplication for one particular task

I have a task like this:

@task(pre=[test_teardown, test_bootstrap], post=[test_teardown])
def test_do(c):
    pass

test_teardown post-task will not run because of task deduplication, but I want it to run before and after the test_do task.

I have tried using a Collection and overriding its default configuration as described here:

test = Collection(
    "test",
    bootstrap=test_bootstrap,
    teardown=test_teardown,
    do=test_do,
)
test.configure({"tasks": {"dedupe": False}})
namespace = Collection(test)

But test_teardown still gets deduplicated.

How can I disable deduplication for this particular task, so that I don't have to specify --no-dedupe on the command line and still have deduplication for other tasks?

Upvotes: 0

Views: 65

Answers (1)

SergiyKolesnikov
SergiyKolesnikov

Reputation: 7815

My current workaround is to specify a dummy parameter for the task that I do not want to be deduplicated. Then I call the teas with different arguments for the dummy parameter. This way, it is not deduplicated (see the box with a note in the docs).

Example:

@task
def test_teardown(c, dummy):
    pass

@task(pre=[call(test_teardown, dummy="pre"), test_bootstrap], post=[call(test_teardown, dummy="post")])
def test_do(c):
    pass

Upvotes: 0

Related Questions