Skipping tasks

Starting in version v0.2.3, users can now skip tasks during project runs if certain, user-defined conditions are met. These conditions should be defined in PrismTask's done method:

# tasks/

import prism.task
import prism.decorators
from pathlib import Path

class HelloWorld(prism.task.PrismTask):
    def done(self):
        return Path("/Users/hello_world.txt").is_file(), 
    def run(self):
        test_str = "Hello, world!"
        return test_str

In the above example, the hello_world.HelloWorld task is skipped if the /Users/hello_world.txt file exists.

Important: although the done method doesn't need to reference a target, it almost always should! Otherwise, future tasks may ref a target that doesn't have any data.

Last updated