Skip to content

Commit

Permalink
FEAT-modin-project#1821: Define .items() simpler
Browse files Browse the repository at this point in the history
Signed-off-by: Vasilij Litvinov <vasilij.n.litvinov@intel.com>
  • Loading branch information
vnlitvinov committed Jul 28, 2020
1 parent 996e6c8 commit 0e99678
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions modin/experimental/cloud/rpyc_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,8 @@ def sync_request(self, handler, *args):
obj, attr = args
else:
obj, attr = args[0], '__str__'
try:
obj_class = object.__getattribute__(obj, '__class__')
except AttributeError:
obj_class = None
if type(obj).__name__ in ('numpy',) or (getattr(obj_class, '__module__', None) in ('numpy',) and obj_class.__name__ in ('dtype',)):

if str(obj.____id_pack__[0]) in {'numpy', 'numpy.dtype'}:
try:
cache = self._static_cache[obj.____id_pack__]
except KeyError:
Expand All @@ -131,24 +128,17 @@ def sync_request(self, handler, *args):

def async_request(self, handler, *args, **kw):
if handler == consts.HANDLE_DEL:
obj, refcount = args
try:
obj_class = object.__getattribute__(obj, '__class__')
except AttributeError:
obj_class = None
if type(obj).__name__ in ('numpy',) or (getattr(obj_class, '__module__', None) in ('numpy',) and obj_class.__name__ in ('dtype',)):
obj, _ = args
if str(obj.____id_pack__[0]) in {'numpy', 'numpy.dtype'}:
"""
# we have this cached, but a deletion is requested, remove the from cache
self._static_cache.pop(obj.____id_pack__, None)
"""
try:
cache = self._static_cache[obj.____id_pack__]
except KeyError:
pass
else:
# object is cached by us, so ignore the request or remote end dies and cache is suddenly stale
if obj.____id_pack__ in self._static_cache:
# object is cached by us, so ignore the request or remote end dies and cache is suddenly stale;
# we shouldn't remove item from cache as it would reduce performance
res = AsyncResult(self)
res._is_ready = True
res._is_ready = True # simulate finished async request
return res
return super().async_request(handler, *args, **kw)

Expand Down

0 comments on commit 0e99678

Please sign in to comment.