How to set up client side lua script search path for aggregate UDFs?


#1

I’m looking for solution as I have to call udf from different python modules and it’s strange to copy Lua UDF file into each python module dir.

I tried

  1. just put lua module into ‘/opt/aerospike/usr/udf/lua/mymod.lua’
  2. add lua script into sys.path:

import sys sys.path sys.path.append(’/opt/aerospike/usr/udf/lua/mymod.lua’)

Both ways don’t work.


#2

Solution is found after diging into source code of python client:

path to the client side Lua scripts for stream UDFs can be defined using config params of the aerospike.Client class:

config = {
        'hosts': ['127.0.0.1']
        'lua': {
            'system_path':'/opt/aerospike/sys/udf/lua/',
            'user_path': '/my/project/path/lua/udf/'
        }
    }

Hope it will help someone.


#3

Thanks, Max. I’ll look to add this to the documentation.