ruby - How can I parallize the execution of my plugins with Celluloid? -


my question should me on right way.

i'm developing ruby application concurrent framework celluloid. here how looks like:

activity

i have plugins. want run them concurrently , wait until last 1 has finished. i've abstract class, called pluginframe, inherited plugin , provides run method.

  1. my idea make supervisiongroup, right idea?
  2. how can run supervisiongroup , wait until group members have finished?
  3. it's idea make separate pluginpool class, manage pool of plugins?
  4. it's interesting me limit pool size, 2 or 3 plugins run @ same time.how can achieve this?

you need supervisor if plugins might crash , want celluloid restart them.

what want simple using pools , futures.

to have shared pool plugins need new actor that.

class pluginrunner   include celluloid    def run(plugin)     plugin.run   end end  plugin_runner = pluginrunner.pool(size: 4)  plugins = [lastfmplugin, twitterplugin] results = plugins.map {|p| plugin_runner.future.run(p) }.map(&:value) persist_results(results) 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -