I've a some analysis code that's written in Python. Currently I'm using Storm to process streams. Because Storm allows invocation of python code using message serialization I an invoke Python code from Java/Scala in my Storm bolts.
I found Pykka which is a Python implementation of the actor model. I was wondering if there is a way to invoke Python code from Akka actors? For example, is it possible to pass message from Akka actors to Pykka actors ?
I doubt that the wire protocols for the two remote actor model implementations could be easily bridged, but you could use 0MQ between the Scala code and a Python app. Akka allows message passing over 0MQ, so after some setup the Scala code could deal with the Python app just like any other actor, although I'm not sure what that would mean on the Python side.
Another possibility worth considering is to run your Python analysis code on the JVM using Jython. You could have a Scala actor call a Jython function/method. But if your Python code makes use of C extension modules, you'd have to find alternatives.
Yet another possibility (also assuming you aren't using C extension modules) is to give the converter py2scala a try; for data analysis code it might do a decent job. Presumably this would give you the most performant solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With