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  2016  2017  <20182019  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  2016  2017  <20182019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: PyEPICS timeout in jupyter
From: "Shen, Guobao" <[email protected]>
To: Matt Newville <[email protected]>
Cc: Talk EPICS Tech <[email protected]>
Date: Tue, 15 May 2018 16:36:20 +0000

Hi Matt,

Yes, the outputs are same from both terminal & jupyter.

I am wondering something wrong with Mac or safari. I had no problem with the same script on my linux box.

 

Here is output from my terminal:

>>> print(epics.ca.find_libca())

/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/clibs/darwin64/libca.dylib

>>> chan = epics.ca.create_channel('test')

>>> conn = epics.ca.connect_channel(chan)

>>> print("Connected ", chan, conn== epics.dbr.CS_CONN)

Connected  c_long(140696518603264) False

>>> val = epics.ca.get(chan)

>>> print(val)

5.6

 

 

And output from jupyter notebook:

 

print(epics.ca.find_libca())

chan = epics.ca.create_channel('test')

conn = epics.ca.connect_channel(chan)

print("Connected ", chan, conn== epics.dbr.CS_CONN)

val = epics.ca.get(chan)

 

/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/clibs/darwin64/libca.dylib

Connected  140535502249016 False

/Users/xxxxxx/anaconda3/anaconda3/lib/python3.6/site-packages/epics/ca.py:1306: UserWarning: ca.get('test') timed out after 1.00 seconds.
  warnings.warn(msg % (name(chid), timeout))

 

Thanks,

Guobao

 

From: <[email protected]> on behalf of Matt Newville <[email protected]>
Date: Tuesday, May 15, 2018 at 11:12 AM
To: "Shen, Guobao" <[email protected]>
Cc: Talk EPICS Tech <[email protected]>
Subject: Re: PyEPICS timeout in jupyter

 

Hi Guobao,

 

On Tue, May 15, 2018 at 10:36 AM, Shen, Guobao <[email protected]> wrote:

Hi,

I am using PyEPICS 3.3.1 together with my conda3 + Python 3.6.

In my terminal, I have no problem to do for example epics.caget().

However, I always get a time out problem in my jupyter notebook when using PyEPICS.

The error message is like:

anaconda3/lib/python3.6/site-packages/epics/ca.py:1306: UserWarning: ca.get('test') timed out after 5.00 seconds.

  warnings.warn(msg % (name(chid), timeout))

 

Is there any environment variable I should set?

 

Hm, maybe. Perhaps the Jupyter kernel has different environmental variables set for how it finds the CA shared library, and how it searches for PVs?

Getting that far suggest that a) the CA shared library was found and initialized, b) that the channel was found and connected, c) that a `ca_array_get_callback()` was called and did not return a SEVCHK error, but that the program gets stuck waiting for the get callback to actually run.   The 5 second timeout for get() on a connected channel seems plenty long enough.

We might need a little bit more information to go on.  First, can you verify that doing

    import epics

    print(epics.ca.find_libca())

gives the same libca as when running python from the Terminal?

Second, if you do

    import epics

    chan = epics.ca.create_channel('test')
    conn = epics.ca.connect_channel(chan)

    print("Connected ", chan, conn== epics.dbr.CS_CONN)

    val = epics.ca.get(chan)

 

do you really see that the channel is connected?  Do you get the same results from running python in the Terminal?

 

 

 

With cothread, I do not have the same issue, therefore, it does not sound like a general EPICS CA variable problem.

 

I'm not sure.  It may be that cothread does not always do `ca_array_get_callback()` and then expect that the callback will be called.  I don't know why that would cause a problem from Jupyter for you.

 

--Matt Newville


Replies:
Re: PyEPICS timeout in jupyter Matt Newville
References:
PyEPICS timeout in jupyter Shen, Guobao
Re: PyEPICS timeout in jupyter Matt Newville

Navigate by Date:
Prev: Re: PyEPICS timeout in jupyter Matt Newville
Next: Re: PyEPICS timeout in jupyter 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  <20182019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: PyEPICS timeout in jupyter Matt Newville
Next: Re: PyEPICS timeout in jupyter 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  <20182019  2020  2021  2022  2023  2024 
ANJ, 15 May 2018 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·