Subject: |
Is There A Way to Explicitly Close CA Connections in PyEpics? |
From: |
Weiwei Lu <[email protected]> |
To: |
tech-talk <[email protected]> |
Date: |
Thu, 18 Aug 2016 12:21:20 -0400 (EDT) |
Hello,
I am writing a Python (2.7.5) program and are using PyEpics in the program. I wanted to explicitly close the CA connections after I created and used them, but found that once a CA connection was created, it stayed connected (the ioc server was up) until the program exited, and there seems to be no way to close it explicitly in the program. I am new to the PyEpics and appreciate any help.
I tried epics.caget(); it created the CA connection and the connection stayed open until the program exited.
I tried pv = epics.PV() and then pv.disconnect(); the disconnect() method closed all the event monitors on the pv, but did not close the connection.
I tried epics.ca.create_channel() and then epics.ca.clear_channel(); the clear_channel() indeed closed the CA connection. But the problem with this approach is that the program would crash if I call epics.ca.create_channel() on the same pv again and try to get the state or value from the returned channel ID, as the following.
>>> chid = epics.ca.create_channel('xxx')
>>> epics.ca.clear_channel(chid)
1
>>> chid = epics.ca.create_channel('xxx')
>>> epics.ca.state(chid)
(crash!)
Finally, calling epics.ca.destroy_context() and epics.ca.create_context() after epics.ca.clear_channel() seems to allow a new connection to be created on the same pv, but that would also wipe out all the existing channels I want to keep.
I used casr on the ioc server to verify CA connections from clients.
Thanks,
William Lu
- Replies:
- Re: Is There A Way to Explicitly Close CA Connections in PyEpics? Matt Newville
- Navigate by Date:
- Prev:
Re: Building SEQ 2.2.3, Windows, EPICS Base 3-15-2 Kevin Peterson
- Next:
Re: Is There A Way to Explicitly Close CA Connections in PyEpics? Matt Newville
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Building SEQ 2.2.3, Windows, EPICS Base 3-15-2 Benjamin Franksen
- Next:
Re: Is There A Way to Explicitly Close CA Connections in PyEpics? Matt Newville
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
<2016>
2017
2018
2019
2020
2021
2022
2023
2024
|