Skip to content

Commit

Permalink
cloudvision/cvlib: Add context cleanup function
Browse files Browse the repository at this point in the history
Adds a context cleanup function to close open connections.
This will be called at the end of a script/template execution
by the script executor infrastructure

Change-Id: I385cd9baf6e33ff904330af62fae5a96538df207
  • Loading branch information
cianmcgrath committed Nov 27, 2024
1 parent cb2e2c4 commit 27d25c6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cloudvision/cvlib/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,16 @@ def __init__(self, user: User,
self.studioCustomData = StudioCustomData(self)
self.workspace: Optional[Workspace] = None

def cleanup(self):
'''
Cleans up open channels and other connections
Called by the script execution infra once a script or template has been executed
'''
if self.__connector:
self.__connector.close()
if self.__serviceChann:
self.__serviceChann.close()

def getDevice(self):
'''
Returns the device associated to the context.
Expand Down

0 comments on commit 27d25c6

Please sign in to comment.