PlasmaCalcs.tools.multiprocessing.UniqueTask

class PlasmaCalcs.tools.multiprocessing.UniqueTask(name, repr=None, module_name=None, unique_includes_module=False)

Bases: Sentinel, Task

a unique task. f, args, and kwargs, should be defined at the class level, not inside __init__.
__init__(*args__None, **kw__None)

Methods

__init__(*args__None, **kw__None)

apply_async(pool, *[, kw])

get_kw([kw])

implied(*args, **kw)

new_with(*args, **kw)

Attributes

args

f

kw

apply_async(pool, *, kw={})
perform the task asynchronously, i.e. pool.apply_async(…)
Equivalent to pool.apply_async(self.f, args=self.args, kwds=self.kw)
kw: dict
kwargs for task will be task.kw, but updated with kw.
E.g. if task.kw = {‘x’: 1}, and kw = {‘y’: 2}, –> task called with x=1, y=2.
get_kw(kw={})
gets self.kw, but updated with values from kw. (doesn’t alter self.kw)
[EFF] if kw is empty, return self.kw instead of making a copy.
classmethod implied(*args, **kw)
return self. If args or kwargs provided, crash with InputError instead.
new_with(*args, **kw)
return self. If args or kwargs provided, crash with InputError instead.