Consodiate CI Python tests and fix bug about multiple ray.init (#4195)

This commit is contained in:
Hao Chen
2019-03-02 06:38:28 +08:00
committed by Robert Nishihara
parent 9c48cc27aa
commit 6f1a29ad3f
4 changed files with 23 additions and 52 deletions
+10 -1
View File
@@ -57,9 +57,11 @@ class RemoteFunction(object):
self._function_signature = ray.signature.extract_signature(
self._function)
# # Export the function.
# Export the function.
worker = ray.worker.get_global_worker()
worker.function_actor_manager.export(self)
# In which session this function was exported last time.
self._last_export_session = worker._session_index
def __call__(self, *args, **kwargs):
raise Exception("Remote functions cannot be called directly. Instead "
@@ -97,6 +99,13 @@ class RemoteFunction(object):
"""An experimental alternate way to submit remote functions."""
worker = ray.worker.get_global_worker()
worker.check_connected()
if self._last_export_session < worker._session_index:
# If this function was exported in a previous session, we need to
# export this function again, because current GCS doesn't have it.
self._last_export_session = worker._session_index
worker.function_actor_manager.export(self)
kwargs = {} if kwargs is None else kwargs
args = ray.signature.extend_args(self._function_signature, args,
kwargs)