support non-modules in @require #3041

Merged
merged 6 commits into from Apr 12, 2013

Projects

None yet

4 participants

@minrk
Member
minrk commented Mar 20, 2013

Functions and other objects can be passed, which implies a push when the function is passed to apply.

This relieves one of the most common complaints in IPython.parallel - allowing multi-function tasks without a push call for the intermediate functions.

def foo(a):
    return a*a

@parallel.require(foo)
def bar(b):
    return foo(b)

@parallel.require(bar)
def baz(c, d):
    return bar(c) - bar(d)

view.apply_sync(baz, 4, 5)

Pinging @ogrisel as the source of the idea at PyData.

minrk added some commits Mar 19, 2013
@minrk minrk support non-modules in @require
Functions and other objects can be passed, which implies a push when the function is passed to apply.
77e4116
@minrk minrk test new @require behavior 2289517
@ogrisel
Contributor
ogrisel commented Mar 20, 2013

It looks good to me. I would like to pull from your branch to give it a try but the Hyatt wifi is failing me...

minrk added some commits Mar 20, 2013
@minrk minrk remove unnecessary double-uncan for @require db19e13
@minrk minrk add hook to CannedObject
so that additional post-processing can happen on uncanning
079dcfe
@minrk minrk use canning hook in dependent
allows the dependency function to be called even before the real task arguments are unpacked.
b70b5db
@minrk minrk docstring for CannedObject.__init__ ebaf52e
@janschulz
Contributor

related to ipython/ipython#2489 ?

@minrk
Member
minrk commented Apr 6, 2013

This is not really related to #2489, other than being an improvement in what objects can be sent and when.

@ellisonbg
Member

I have ran the test suite locally under python 2.7 (passed), tried some examples in the notebook and looked through the code. Looks like a nice improvement. I am +1 on merging.

@ellisonbg ellisonbg merged commit 4be107e into ipython:master Apr 12, 2013

1 check passed

default The Travis build passed
Details
@minrk minrk deleted the minrk:requirepush branch Mar 31, 2014
@akhmerov akhmerov referenced this pull request in ipython/ipyparallel Sep 28, 2015
Closed

Obsolete description of @require in the docs. #43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment