import argparse import orchpy import orchpy.services as services import orchpy.worker as worker parser = argparse.ArgumentParser(description='Parse addresses for the worker to connect to.') parser.add_argument("--scheduler-address", default="127.0.0.1:10001", type=str, help="the scheduler's address") parser.add_argument("--objstore-address", default="127.0.0.1:20001", type=str, help="the objstore's address") parser.add_argument("--worker-address", default="127.0.0.1:40001", type=str, help="the worker's address") @worker.distributed([str], [str]) def print_string(string): print "called print_string with", string f = open("asdfasdf.txt", "w") f.write("successfully called print_string with argument {}.".format(string)) return string @worker.distributed([int, int], [int, int]) def handle_int(a, b): return a + 1, b + 1 if __name__ == '__main__': args = parser.parse_args() worker.connect(args.scheduler_address, args.objstore_address, args.worker_address) worker.global_worker.register_function(print_string) worker.global_worker.register_function(handle_int) worker.main_loop()