EPICS Home

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  <20152016  2017  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  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: pyepics not updating pv.enum_strs after connection
From: Matt Newville <[email protected]>
To: Jameson Graef Rollins <[email protected]>
Cc: EPICS tech-talk <[email protected]>
Date: Tue, 24 Mar 2015 22:46:59 -0500
Hi Jamie,

On Mon, Mar 23, 2015 at 6:29 PM, Jameson Graef Rollins <[email protected]> wrote:
On Thu, Mar 19 2015, Matt Newville <[email protected]> wrote:
> I think it kind of depends what you're trying to do.  FWIW, I have lots of
> GUIs that display Epics variables and get control values in a "lazy
> manner".    Generally, one can create a PV, then ask some function to be
> run when the GUI is not busy where you wait-for-connection, get the control
> variables, and add callbacks (in the case where the widgets don't even
> exist when the PV is created-without-connection).   Another approach would
> be to use a Timer loop look for newly connected PVs (those for which
> pv.connected was False and is now True) and finish setting up the pvs as
> they connect (including getting ctrl vars).

Hi, Matt.  I set up something similar to what you've suggested here and
it seems to work ok.  A few seconds after initialization a function gets
executed that periodically checks for newly connected channels and
updates their ctrl attributes.  The ENUM records then start to get
filled in with the proper values after the program has been running for
a couple of seconds.  Thanks so much for the suggestions.

>> I still don't understand why the enum_strs attribute can't just be
>> updated automatically when the connection is first made, without
>> having to retrieve it manually at some point.  It would certainly
>> make things easier from my perspective.
>
> That would be possible.  It's not clear to me that every PV always needs
> CTRL variables to be fetched as part of the automatic connection process --
> I might be persuaded to add this as an option,, but am not certain it's
> necessarily always a good idea.    It might slow down the connection (I
> have not profiled it carefully), but it's probably acceptable in many
> situations.

The process I describe above to get this working seems pretty hacky to
me, especially given that this is probably a fairly use case (especially
for any GUI apps).  It would certainly make things much easier from an
end programmers perspective if it were possible to specify that the
connection callback could also just update the ctrl attributes
automatically.

Yes, I think this idea of getting the ctrl variables in the connection callback is a good idea, and will allow more straightforward code  As it is, a pyepics.PV is already expected to be a "rich" object, even if sacrificing ultimate performance, and is normally expected to have the ctrl variables.   So, I think it's reasonable to have this getting of ctrl variables as the default.    I'll add that.

But, I'm glad the work-around for this is working for you.

--Matt


Replies:
Re: pyepics not updating pv.enum_strs after connection Dirk Zimoch
References:
pyepics not updating pv.enum_strs after connection Jameson Graef Rollins
Re: pyepics not updating pv.enum_strs after connection Jameson Graef Rollins
Re: pyepics not updating pv.enum_strs after connection Matt Newville
Re: pyepics not updating pv.enum_strs after connection Jameson Graef Rollins
Re: pyepics not updating pv.enum_strs after connection Matt Newville
Re: pyepics not updating pv.enum_strs after connection Jameson Graef Rollins
Re: pyepics not updating pv.enum_strs after connection Matt Newville
Re: pyepics not updating pv.enum_strs after connection Jameson Graef Rollins

Navigate by Date:
Prev: Re: procServ+devIocStats questions Michael Davidsaver
Next: Re: Strange StreamDev behaviour Jörn Wüstenfeld
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: pyepics not updating pv.enum_strs after connection Jameson Graef Rollins
Next: Re: pyepics not updating pv.enum_strs after connection Dirk Zimoch
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024