diff options
author | Clement Farabet <clement.farabet@gmail.com> | 2011-09-05 08:22:39 +0400 |
---|---|---|
committer | Clement Farabet <clement.farabet@gmail.com> | 2011-09-05 08:22:39 +0400 |
commit | 69327936c2ce1d4e521dd1d1eec8c5afbe5e0cc3 (patch) | |
tree | 1ffff0847d7bb4c4b511d00c61ae51c609ab0f78 | |
parent | ecd615e257bc819a85eb1d97d9ebac3a6de989f0 (diff) |
Protected map-reduce setup.
-rw-r--r-- | BatchOptimization.lua | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/BatchOptimization.lua b/BatchOptimization.lua index ebf2144..9673768 100644 --- a/BatchOptimization.lua +++ b/BatchOptimization.lua @@ -305,12 +305,16 @@ function Batch:setup_mapreduce () end ]] - -- (2) startup all workers - parallel.sfork(self.parallelize) - parallel.children:exec(worker_code) - - -- (3) and send them the module + criterion architecture - parallel.children:join() - parallel.children:send(self.module) - parallel.children:send(self.criterion) + local setup = function() + -- (2) startup all workers + parallel.sfork(self.parallelize) + parallel.children:exec(worker_code) + + -- (3) and send them the module + criterion architecture + parallel.children:join() + parallel.children:send(self.module) + parallel.children:send(self.criterion) + end + local ok,err = pcall(setup) + if not ok then print(err) parallel.close() end end |