add case when errors is garbage collected
This commit is contained in:
parent
45e0468e02
commit
009a1b8c4c
@ -150,17 +150,22 @@ class Server(object):
|
|||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
|
# At shutdown, `errors` may have been garbage collected.
|
||||||
|
if errors is not None:
|
||||||
|
exception = errors.UnimplementedError
|
||||||
|
else:
|
||||||
|
exception = Exception
|
||||||
try:
|
try:
|
||||||
c_api.TF_ServerStop(self._server)
|
c_api.TF_ServerStop(self._server)
|
||||||
# Clean shutdown of servers is not yet implemented, so
|
# Clean shutdown of servers is not yet implemented, so
|
||||||
# we leak instead of calling c_api.TF_DeleteServer here.
|
# we leak instead of calling c_api.TF_DeleteServer here.
|
||||||
# See:
|
# See:
|
||||||
# https://github.com/tensorflow/tensorflow/blob/0495317a6e9dd4cac577b9d5cf9525e62b571018/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h#L73
|
# https://github.com/tensorflow/tensorflow/blob/0495317a6e9dd4cac577b9d5cf9525e62b571018/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h#L73
|
||||||
except errors.UnimplementedError:
|
|
||||||
pass
|
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# At shutdown, `c_api` may have been garbage collected.
|
# At shutdown, `c_api` may have been garbage collected.
|
||||||
pass
|
pass
|
||||||
|
except exception:
|
||||||
|
pass
|
||||||
self._server = None
|
self._server = None
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user