Internal¶
The second call will generate a new task instance depends on
(ch1, ch2, ch3)
and return a newChannel
.
task = Task()
output_ch = task(ch1, ch2, ch3)
For each task instance, will get a unique
task_key
equals to it’s working directory, since a task object can be used multiple times, so there may be multiple tasks share the sametask_key
.
task.task_key = classname-hash(task.run_job.__code__ + task.run.__annotation__ + other_info)
task.task_workdir = task.config_dict.task_workdir/task.task_key
For each input of
task.run
, the run will have arun_key
equals to it’s working directory
run.task_workdir = run_key = task.task_workdir/hash(inputs, other_info)
All task objects with the same
task_key
will share the samelock pool
andcache
, different runs will be scheduled in parallel but runs with the samerun_key
will compete for a sharingrun_key
lock to avoid conflictions.For task receives no input channels, the task’s will only be ran once
output_ch = task()