From 6bd26576cc73334131cc44a559db9e8af7a82713 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Fri, 24 Jun 2016 19:57:44 -0700 Subject: [PATCH] don't return empty list when there are no return values (#157) --- lib/python/ray/worker.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/python/ray/worker.py b/lib/python/ray/worker.py index 70e199467..dcf39131e 100644 --- a/lib/python/ray/worker.py +++ b/lib/python/ray/worker.py @@ -207,7 +207,10 @@ def remote(arg_types, return_types, worker=global_worker): args.extend([kwargs[keyword] if kwargs.has_key(keyword) else default for keyword, default in func_call.keyword_defaults[len(args):]]) # fill in the remaining arguments check_arguments(func_call, args) # throws an exception if args are invalid objrefs = worker.submit_task(func_call.func_name, args) - return objrefs[0] if len(objrefs) == 1 else objrefs + if len(objrefs) == 1: + return objrefs[0] + elif len(objrefs) > 1: + return objrefs func_call.func_name = "{}.{}".format(func.__module__, func.__name__) func_call.executor = func_executor func_call.arg_types = arg_types