intern

function of dascore.workflow.task source

intern(
    task: Task ,
)-> ‘Task’

Return one shared instance for every task which equals the given one.

A patch function called in a loop builds an equal task every call. Interning them means the provenance of a thousand patches holds one task object rather than a thousand copies of it.

Examples

from dascore.workflow import Task, intern
class ScaleExample(Task):
    factor: float = 1.0
assert intern(ScaleExample()) is intern(ScaleExample())