Skip to content
Snippets Groups Projects
Unverified Commit 4ad62ecb authored by leaves-zwx's avatar leaves-zwx Committed by GitHub
Browse files

Fix Session TryClose (#5531)

* fix TryClose

* fix addressing watch callback
parent de29655f
No related branches found
No related tags found
No related merge requests found
......@@ -235,6 +235,11 @@ class Session(object):
if self.status_ is SessionStatus.RUNNING:
self.Close()
if self.status_ != SessionStatus.CLOSED:
oneflow._oneflow_internal.ClearSessionById(self.id)
self.status_ = SessionStatus.CLOSED
def Close(self):
assert self.status_ is SessionStatus.RUNNING
self.Sync()
......@@ -442,7 +447,7 @@ class Session(object):
self.cond_var_.release()
def __del__(self):
oneflow._oneflow_internal.ClearSessionById(self.id)
self.TryClose()
@oneflow_export("find_or_create_module")
......
......@@ -220,6 +220,11 @@ class Session(object):
if self.status_ is SessionStatus.RUNNING:
self.Close()
if self.status_ != SessionStatus.CLOSED:
oneflow._oneflow_internal.ClearSessionById(self.id)
self.status_ = SessionStatus.CLOSED
def Close(self):
assert self.status_ is SessionStatus.RUNNING
self.Sync()
......@@ -427,7 +432,7 @@ class Session(object):
self.cond_var_.release()
def __del__(self):
oneflow._oneflow_internal.ClearSessionById(self.id)
self.TryClose()
@oneflow_export("find_or_create_module")
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment