UniqueTask
- class PlasmaCalcs.tools.multiprocessing.UniqueTask(name, repr=None, module_name=None, unique_includes_module=False)
-
a unique task. f, args, and kwargs, should be defined at the class level, not inside __init__.
Methods
__call__(**kw)perform the task, i.e. return f(*args, **kw).
__new__(cls, name[, repr, module_name, ...])return new Sentinel object.
apply_async(pool, *[, kw])perform the task asynchronously, i.e. pool.apply_async(...).
get_kw([kw])gets self.kw, but updated with values from kw.
implied(*args, **kw)return self.
new_with(*args, **kw)return self.
Attributes
argsfkw- __call__(**kw)
perform the task, i.e. return f(*args, **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.
- static __new__(cls, name, repr=None, module_name=None, unique_includes_module=False)
return new Sentinel object.
- 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.