Success Story with Plone + Pyro4

One of my Plone project require external web data that I need to crawl using requests and cache in mysql.

Why use Pyro4

  • Better cpu process/thread spread
  • Python3
  • Separate MySQL from Plone

This is my setup:

  1. Create Plone buildout and the usual stuff.
  2. Create a separate python3 virtualenv and buildout for Pyro4 and packages.

The use pattern to remote calls pyro objects in Plone package/module. e.g

src/myplonepackage/__init__.py

import Pyro4
rtool = Pyro4.Proxy('PYRONAME:my_remote_helper')

src/myplonepackage/browser/myview.py

from myplonepackage import rtool

class CheckPrice(BrowserView):
        def __call__(self):
            last_price = rtool.get_stock_last_price(“AAPL”)

            # non-block one_way call
            rtool.cache_data_to_db(“AAPL”)

            return last_price

I also use RQ inside pyro4 package to manage queue, another sharing when time permitted.

Enjoy.

1 Like