tasks
In the previous section, we saw that tasks needs to have two parameters: tasks, and hooks:
# tasks/hello_world.py
import prism.task
import prism.target
class HelloWorld(prism.task.PrismTask):
def run(self, tasks, hooks):
test_str = "Hello, world!"
return test_str# tasks/hello_world.py
from prism.decorators import task
@task()
def hello_world(tasks, hooks):
test_str = "Hello, world!"
return test_strBoth are critical for Prism to run, and Prism will throw an error if it finds a task without both parameters.
tasks is an instance of the prism.infra.task_manager.TaskManager class. At the moment this class has the following functions (see the API reference for more information):
tasks.ref(): for referencing the output of other tasks in your project
Next, we'll cover exactly what these functions do.