Define :task factory