Warning
This documentation is for an old version of IPython. You can find docs for newer versions here.
Dependency utilities
Authors:
Bases: object
Dependency decorator, for use with tasks.
@depend lets you define a function for engine dependencies just like you use apply for tasks.
Examples
@depend(df, a,b, c=5)
def f(m,n,p)
view.apply(f, 1,2,3)
will call df(a,b,c=5) on the engine, and if it returns False or raises an UnmetDependency error, then the task will not be run and another engine will be tried.
Bases: object
A function that depends on another function. This is an object to prevent the closure used in traditional decorators, which are not picklable.
Bases: set
An object for representing a set of msg_id dependencies.
Subclassed from set().
Parameters: | dependencies: list/set of msg_ids or AsyncResult objects or output of Dependency.as_dict() :
all : bool [default True]
success : bool [default True]
failure : bool [default False]
If `all=success=True` and `failure=False`, then the task will fail with an ImpossibleDependency :
|
---|
Represent this dependency as a dict. For json compatibility.
check whether our dependencies have been met.
return whether this dependency has become impossible.
Simple decorator for requiring local objects and modules to be available when the decorated function is called on the engine.
Modules specified by name or passed directly will be imported prior to calling the decorated function.
Objects other than modules will be pushed as a part of the task. Functions can be passed positionally, and will be pushed to the engine with their __name__. Other objects can be passed by keyword arg.
Examples
In [2]: foo = lambda x: x*x In [3]: @require(foo)
...: def bar(a): ...: return foo(1-a)