PythonScalarFunctionRunner is responsible for Python ScalarFunction execution and it only handles the Python ScalarFunction execution and nothing else. So its logic should be very simple, forwarding an input element to Python worker and fetching the execution results back:
- Internally, it uses Apache Beam’s portability for Python UDF execution and this is transparent for the caller of PythonScalarFunctionRunner
- By default, each runner will startup a separate Python worker
- The Python worker can run in a docker, a separate process or even an non-managed external service.
- It has the ability to execute multiple Python ScalarFunctions
- It also supports chained Python ScalarFunctions