# Add the ampy module to our PYTHONPATH before importing it ampy_dir = dirname(dirname(dirname(abspath(__file__)))) + '/workers/python' path.append(ampy_dir) import ampy # ------------------------------- DEFINE SOME FUNCTIONS HERE --------------------------------------- def my_func(workload): return workload def hello_world(arg=None): return 'Hello, World!' # ------------------------------- LISTEN FOR WORK DISPATCHES --------------------------------------- if __name__ == "__main__": # Only functions defined in the callables dictionary are available for use callables = { 'len': len, # Native len() function 'my_func': my_func, # Custom function defined above 'hello_world': hello_world # Custom function defined above } ampy.listen(callables)
from sys import path from os.path import dirname, abspath # Add the ampy module to our PYTHONPATH before importing it ampy_dir = dirname(dirname(dirname(abspath(__file__)))) + '/workers/python' path.append(ampy_dir) import ampy # ------------------------------- DEFINE SOME FUNCTIONS HERE --------------------------------------- def my_func(workload): return workload def hello_world(arg = None): return 'Hello, World!' # ------------------------------- LISTEN FOR WORK DISPATCHES --------------------------------------- if __name__ == "__main__": # Only functions defined in the callables dictionary are available for use callables = { 'len': len, # Native len() function 'my_func': my_func, # Custom function defined above 'hello_world': hello_world # Custom function defined above } ampy.listen(callables)
from sys import path from os.path import dirname, abspath ampy_dir = dirname(dirname(dirname(abspath(__file__)))) + '/workers/python' path.append(ampy_dir) import ampy if __name__ == "__main__": ampy.listen({'len': len})