EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: SNL sequencer apparently losing connection to underlying network
From: Matt Newville <[email protected]>
To: Benjamin Franksen <[email protected]>
Cc: Kevin Meyer <[email protected]>, Tech-talk <[email protected]>
Date: Tue, 6 Dec 2016 15:06:38 -0600
Hi Ben,

On Tue, Dec 6, 2016 at 10:50 AM, Benjamin Franksen <[email protected]> wrote:
On 02.12.2016 15:30, Matt Newville wrote:
> But, to summarize the earlier suggestions: if you are embedding pyepics in
> SNL,  you might need to create a new CA context in the python script with
>     import epics
>     epics.ca.context_create(0)

Hi Matt

I may be wrong but I think this is what already happens (implicitly).
The problem is that the newly created context replaces (overwrites) the
old one and then (afterwards) channels created against the old context
fail to work.

My suggestion (to repeat) is to use ca_current_context to get the
existing CA client context on startup (so that you don't overwrite the
existing context with a new one) and to somehow convince the Python
binding to NOT call ca_context_destroy when it exits. For this you could
perhaps use ca_detach_context before Python shuts down (to avoid killing
the existing context) but then you would have to save and restore the
context inside the SNL code. However, perhaps the shutdown is not really
a problem because the Python runtime system is kept alive all the time?
(I.e. as long as the SNL is running) In that case, simply ignore shutdown.

 
Ah, I see. That makes sense. It would require a change to pyepics, which currently always create a context when loading the DLL, and does not allow for attaching to a context that may already exist in that process.

By default, pyepics also calls context_destroy() as the process is exiting.  I'm not entirely sure what would happen if that's embedded.  That can be turned off, but is on by default.

It looks like some changes would have to be made to pyepics in order to use it in a python session that is embedded in a process that is also doing CA, such as a SNL program. 

I would ask Kevin how important this approach was.  We might be able to fix pyepics so it could work in a session launched from within an SNL program, but it seems to me like there might be better approaches.

Thanks,

--Matt


References:
Re: SNL sequencer apparently losing connection to underlying network Kevin Meyer
Re: SNL sequencer apparently losing connection to underlying network Benjamin Franksen
Re: SNL sequencer apparently losing connection to underlying network Kevin Meyer
Re: SNL sequencer apparently losing connection to underlying network Benjamin Franksen
Re: SNL sequencer apparently losing connection to underlying network Matt Newville
Re: SNL sequencer apparently losing connection to underlying network Kevin Meyer
Re: SNL sequencer apparently losing connection to underlying network Matt Newville
Re: SNL sequencer apparently losing connection to underlying network Benjamin Franksen

Navigate by Date:
Prev: RE: Simultaneous Channel access matthew.taylor
Next: MVME5500 and turbo-pmac-vme-ultralite zzh
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: SNL sequencer apparently losing connection to underlying network Benjamin Franksen
Next: Channel Archiver - Data Conversion / Export from File to RDBArchiver PostgreSQL database Zumbruch, Peter Dr.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 06 Dec 2016 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·