Add the extra fallback for serialization (#3468)

* Add the extra fallback for serialization.

* Better comments & warnings. quotes.

* Update test/runtest.py

Co-Authored-By: suquark <suquark@gmail.com>

* Update test/runtest.py

Co-Authored-By: suquark <suquark@gmail.com>

* linting

* Don't hijack too much errors.

* simplify the test

* Update runtest.py

* simplify
This commit is contained in:
Si-Yuan
2018-12-05 13:09:08 -08:00
committed by Philipp Moritz
parent 06f6431765
commit 2e6f9bedf2
2 changed files with 28 additions and 0 deletions
+11
View File
@@ -418,6 +418,17 @@ class Worker(object):
logger.info(
"The object with ID {} already exists in the object store."
.format(object_id))
except TypeError:
# This error can happen because one of the members of the object
# may not be serializable for cloudpickle. So we need these extra
# fallbacks here to start from the beginning. Hopefully the object
# could have a `__reduce__` method.
register_custom_serializer(type(value), use_pickle=True)
warning_message = ("WARNING: Serializing the class {} failed, "
"so are are falling back to cloudpickle."
.format(type(value)))
logger.warning(warning_message)
self.store_and_register(object_id, value)
def retrieve_and_deserialize(self, object_ids, timeout, error_timeout=10):
start_time = time.time()