@target(...)
Decorator used to write the output of a task function.
prism.decorators.target(*, type: prism.target.PrismTarget, loc: Union[str, pathlib.Path])
- Parameters - *: indicates that the- targetdecorator only accepts keyword arguments.
- type: a valid Prism target. This controls the output type, e.g., a- .txtfile, a- .csv, a- .json, etc. Prism targets are classes that inherit the- prism.target.PrismTargetclass and implement the- savemethod. See here.
- loc: a string or path-like object that controls where the output saved.
 
Example:
import prism.task
import prism.target
import prism.decorators
class ExampleTask(prism.task.PrismTask):
    
    @prism.decorators.target(
        type=prism.target.Txt, 
        loc="/Users/hello_world.txt",
        **kwargs
    )
    def run(self):
        test_str = "Hello, world!"
        return test_strfrom prism.decorators import task, target
import prism.target
@task(
    targets=[
        target(type=prism.target.Txt, loc="/Users/hello_world.txt")
    ]
)
def example_function(tasks, hooks):
    test_str = "Hello, world!"
    return test_strLast updated
