pygridtools / gridmap

Easily map Python functions onto a cluster using a DRMAA-compatible grid engine like Sun Grid Engine (SGE).
GNU General Public License v3.0
84 stars 34 forks source link

Modify function module check to allow partial object #65

Closed cjw85 closed 9 years ago

cjw85 commented 9 years ago

The checks in Job.function() stop partial objects being used. if m.name != "main": self._f = f

The proposed modification allows gridmap to work with a functools.partial object.

dan-blanchard commented 9 years ago

Huh. I had never thought to try out gridmap with a partial function before. Could you please add a test to tests/test_gridmap.py to verify that this works?

cjw85 commented 9 years ago

Sure, I'd started writing some, but got sidetracked.

The reason for wanting to use a partial is I have already a widely used utility function within my project that applies functools.partial and decorators to a function before handing off to either itertools.imap or multiprocessing.Pool.imap_unordered. I'd like a third option of handing off to gridmap, without forcing too much extra baggage on the caller.

dan-blanchard commented 9 years ago

Didn't realize you added the tests until now. Thanks, this looks great!