ecell / ecell4

An integrated software environment for multi-algorithm, multi-timescale, multi-spatial-representation simulation of various cellular phenomena
https://ecell4.e-cell.org/
GNU General Public License v3.0
17 stars 9 forks source link

Enable reducer in ensemble functions #17

Open kaizu opened 6 years ago

kaizu commented 6 years ago
jobs = ((1, 'spam'), (2, 'ham'), (3, 'eggs'))
target = lambda args, job_id, task_id: (args[1] * args[0])
run_serial(target, jobs)  # => [['spam'], ['hamham'], ['eggseggseggs']]
reducer = lambda x, y: x + len(y)
run_serial(target, jobs, reducer=reducer, initializer=0)  # => [22]