mirror of
https://github.com/wassname/ray.git
synced 2026-09-10 12:38:43 +08:00
function return working with one return value
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import orchpy.unison as unison
|
||||
import orchpy.services as services
|
||||
import orchpy.worker as worker
|
||||
|
||||
@worker.distributed([str], [str])
|
||||
def print_string(string):
|
||||
print "called print_string with", string
|
||||
return string
|
||||
|
||||
if __name__ == '__main__':
|
||||
worker.global_worker.connect("127.0.0.1:22221", "127.0.0.1:40000", "127.0.0.1:22222")
|
||||
|
||||
worker.global_worker.register_function("hello_world", print_string, 1)
|
||||
worker.global_worker.start_worker_service()
|
||||
|
||||
worker.global_worker.main_loop()
|
||||
@@ -0,0 +1,16 @@
|
||||
import orchpy.unison as unison
|
||||
import orchpy.services as services
|
||||
import orchpy.worker as worker
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
worker = worker.Worker()
|
||||
worker.connect("127.0.0.1:22221", "127.0.0.1:50000", "127.0.0.1:22222")
|
||||
worker.start_worker_service()
|
||||
worker.register_function("hello_world", None, 0)
|
||||
name, args, returnref = worker.wait_for_next_task()
|
||||
print "received args ", args
|
||||
if args == ["hi"]:
|
||||
sys.exit(0)
|
||||
else:
|
||||
sys.exit(1)
|
||||
Reference in New Issue
Block a user