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 2025 | 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 2025 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: How to set timeout for reading a pyepics device attribute [SEC=UNOFFICIAL] |
From: | Matt Newville via Tech-talk <[email protected]> |
To: | "CORNALL, Terry" <[email protected]> |
Cc: | "[email protected]" <[email protected]> |
Date: | Tue, 3 Dec 2019 10:05:26 -0600 |
Hi All.
If I use pyepics devices, such as a motor, via:
m=epics.Motor('SR10BM01SPAL03:SPIN’, timeout=5)
And then try to read some attribute, like:
jvel=m.JVEL
it sometimes happens that the attempt to read the attribute times out in 1 second. (rare, but it does happen)
UserWarning: ca.get('SR10BM01SPAL03:SPIN.JVEL') timed out after 1.00 seconds.
The timeout=5 specified in creating the device instance above in my example appears to be a ‘connection timeout’ used when first making the device instance rather than the timeout used when getting an attribute value.
I’ve pondered the code and doco but can’t see how to set the timeout that applies to reading an attribute.
If I use an epics.Motor.get() like
Jvel=m.get(‘JVEL’, timeout=5)
I get an error about unexpected keyword argument ‘timeout’, and looking at the code in epics/motor.py supports that I can’t do it that way.
According to code in epics/motor.py, Motor.get() uses PV.get() but doesn’t specify any timeout so I get stuck with a hard-coded 1 second.
I guess I can get the epics.Motor’s PV as a string and then attach the attribute string and then use PV.get(pvstring, timeout=5) but it seems a bit hacky if there is a better way that I’ve missed.
Any thoughts?
Terry