Giter VIP home page Giter VIP logo

Comments (12)

vstadnytskyi-FDA avatar vstadnytskyi-FDA commented on June 12, 2024 1

It makes no sense. Now it is working. I will try to reproduce the error or maybe indeed I had a typo in the name.

from caproto.

klauer avatar klauer commented on June 12, 2024

Can you do a caproto-get -vvv with the image/frameID and let us see how it's being discovered?

from caproto.

vstadnytskyi-FDA avatar vstadnytskyi-FDA commented on June 12, 2024

Here is what I am getting on the server side


DEBUG:caproto.bcast:VersionRequest(priority=0, version=13)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:image', cid=41928, version=13, reply=5)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:frameID', cid=41929, version=13, reply=5)
DEBUG:caproto.bcast:VersionResponse(version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41928, version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41929, version=13)
DEBUG:caproto.bcast:VersionRequest(priority=0, version=13)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:image', cid=41928, version=13, reply=5)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:frameID', cid=41929, version=13, reply=5)
DEBUG:caproto.bcast:VersionResponse(version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41928, version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41929, version=13)
DEBUG:caproto.bcast:VersionRequest(priority=0, version=13)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:image', cid=26009, version=13, reply=5)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:frameID', cid=26010, version=13, reply=5)
DEBUG:caproto.bcast:VersionResponse(version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=26009, version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=26010, version=13)
DEBUG:caproto.bcast:Beacon(version=13, server_port=5064, beacon_id=48, address='0.0.0.0')
DEBUG:caproto.bcast:VersionRequest(priority=0, version=13)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:image', cid=41928, version=13, reply=5)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:frameID', cid=41929, version=13, reply=5)
DEBUG:caproto.bcast:VersionResponse(version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41928, version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41929, version=13)
DEBUG:caproto.bcast:VersionRequest(priority=0, version=13)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:image', cid=41928, version=13, reply=5)
DEBUG:caproto.bcast:SearchRequest(name='camera_FDA:frameID', cid=41929, version=13, reply=5)
DEBUG:caproto.bcast:VersionResponse(version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41928, version=13)
DEBUG:caproto.bcast.search:SearchResponse(port=5064, ip='255.255.255.255', cid=41929, v

from caproto.

vstadnytskyi-FDA avatar vstadnytskyi-FDA commented on June 12, 2024
>caproto-get -vvv camera_FDA.image
[D 17:12:54.183     repeater:  221] Another repeater is already running; will not spawn one.
[D 17:12:54.183       client:   59] Registering with the Channel Access repeater.
[D 17:12:54.183 _broadcaster:   94] (1 of 1) RepeaterRegisterRequest(client_address='0.0.0.0')
[D 17:12:54.183       _utils:  535] Netifaces unavailable; using 127.0.0.1 as local address
[D 17:12:54.183       client:   74] Searching for 'camera_FDA.image'....
[D 17:12:54.183 _broadcaster:   94] (1 of 2) VersionRequest(priority=0, version=13)
[D 17:12:54.183 _broadcaster:   92] (2 of 2) SearchRequest(name='camera_FDA.image', cid=6014, version=13, reply=5)
[D 17:12:54.183       client:   88] 0.0.0.0:50222 --->>> 255.255.255.255:5064 2 commands 56B
[D 17:12:54.183 _broadcaster:  136] 0.0.0.0:50222 <<<--- 127.0.0.1:5065 16B RepeaterConfirmResponse(repeater_address='127.0.0.1')
[D 17:12:55.190       client:   88] 0.0.0.0:50222 --->>> 255.255.255.255:5064 1 commands 56B
[D 17:12:56.190       client:   88] 0.0.0.0:50222 --->>> 255.255.255.255:5064 1 commands 56B
Traceback (most recent call last):
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 123, in search
    bytes_received, address = udp_sock.recvfrom(ca.MAX_UDP_RECV)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\Scripts\caproto-get.exe\__main__.py", line 7, in <module>
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\commandline\get.py", line 172, in main
    response = read(pv_name=pv_name,
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 353, in read
    chan = make_channel(pv_name, udp_sock, priority, timeout)
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 160, in make_channel
    address = search(pv_name, udp_sock, timeout)
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 138, in search
    check_timeout()
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 105, in check_timeout
    raise CaprotoTimeoutError(f"Timed out while awaiting a response "
caproto._utils.CaprotoTimeoutError: Timed out while awaiting a response from the search for 'camera_FDA.image'. Search requests were sent to this address list: ['255.255.255.255'].

It says " Netifaces unavailable; using 127.0.0.1 as local address"

from caproto.

klauer avatar klauer commented on June 12, 2024

I think you may have mistyped the PV name, unless you changed it between the captured outputs you did (camera:image vs camera_FDA.image) - specifically the . vs the :

I'd recommend installing netifaces as it more reliably determines information about your environment and can choose better default settings for broadcast requests and such.

from caproto.

vstadnytskyi-FDA avatar vstadnytskyi-FDA commented on June 12, 2024

I think you may have mistyped the PV name, unless you changed it between the captured outputs you did (camera:image vs camera_FDA.image) - specifically the . vs the :

I'd recommend installing netifaces as it more reliably determines information about your environment and can choose better default settings for broadcast requests and such.

I think PV name is correct

[I 17:22:00.221 server: 183] PVs available:
camera_FDA:image
camera_FDA:timestamp_lab
camera_FDA:timestamp_camera
camera_FDA:frameID
camera_FDA:exposure_time

from caproto.

vstadnytskyi-FDA avatar vstadnytskyi-FDA commented on June 12, 2024

I will close it for now. I am not sure how to reproduce the error. I guess it was indeed wrong name of the PV I was trying to access.

from caproto.

vstadnytskyi avatar vstadnytskyi commented on June 12, 2024

I was able to reproduce the problem.

CAproto server code


from logging import debug,info,warning,error
from caproto.server import pvproperty, PVGroup, SubGroup, ioc_arg_parser, run
from numpy import nan, zeros, int16, random

class Server(PVGroup):
    
    image = pvproperty(value=zeros((3,100,100)).flatten(), dtype = int, max_length = 4000000)
    dt = pvproperty(value = 1.0)

    @image.startup
    async def image(self, instance, async_lib):
        while True:
            new_arr = random.randint(256, size=(3, 100, 100)).flatten()
            await self.image.write(value=new_arr)
            await async_lib.library.sleep(self.dt.value)

if __name__ == '__main__':
    prefix = 'BITMAP_IMAGE:'
    from pdb import pm
    from tempfile import gettempdir
    import logging
    print(gettempdir()+'/{}.log'.format(prefix))
    logging.basicConfig(filename=gettempdir()+'/{}.log'.format(prefix),
                        level=logging.INFO, format="%(asctime)s %(levelname)s: %(message)s")

    ioc_options, run_options = ioc_arg_parser(
        default_prefix=prefix,
        desc='description')

    io_server  = Server(**ioc_options)

    #start async caproto server IO
    run(io_server.pvdb, **run_options)

and here is the output from terminal

C:\Users\AR-VR lab W1\Documents\Valentyn\custom_python_libraries\instrumentation\external_screen>python bitmap_image_server.py --list-pvs
C:\Users\AR-VRL~1\AppData\Local\Temp/BITMAP_IMAGE:.log
[I 18:09:46.289       server:  137] Asyncio server starting up...
[I 18:09:46.289       server:  144] Listening on 0.0.0.0:5064
[I 18:09:46.289       server:  181] Server startup complete.
[I 18:09:46.289       server:  183] PVs available:
    BITMAP_IMAGE:image
    BITMAP_IMAGE:dt

and caproto threading client code

#!/usr/bin/env python3
from caproto.threading.client import Context
prefix='BITMAP_IMAGE:'
ctx = Context()
pv_name = prefix+'dt'
print(f'reading PV: {pv_name}')
dt, = ctx.get_pvs(pv_name)
pv_name = prefix+'image'
print(f'reading PV: {pv_name}')
image, = ctx.get_pvs(pv_name)

and here is terminal output from client

In [1]: run bitmap_image_terminal_client.py       
Removing <caproto.threading.client.SharedBroadcaster object at 0x000001EF8573E940> due to [WinError 
10054] An existing connection was forcibly closed 
by the remote host (10054)
reading PV: BITMAP_IMAGE:dt
reading PV: BITMAP_IMAGE:image

from caproto.

vstadnytskyi-FDA avatar vstadnytskyi-FDA commented on June 12, 2024
In [4]: sys.version_info
Out[4]: sys.version_info(major=3, minor=8, micro=8, releaselevel='candidate', serial=1)

In [6]: platform.platform()
Out[6]: 'Windows-10-10.0.19041-SP0'

In [8]: caproto.__version__
Out[8]: '0.8.1'

It seems first I can see PV with caproto-get command but there is an error later.

C:\Users\AR-VR lab W1>caproto-get -vvv BITMAP_IMAGE:image
[D 18:26:46.382     repeater:  221] Another repeater is already running; will not spawn one.
[D 18:26:46.382       client:   59] Registering with the Channel Access repeater.
[D 18:26:46.382 _broadcaster:   94] (1 of 1) RepeaterRegisterRequest(client_address='0.0.0.0')
[D 18:26:46.382       _utils:  535] Netifaces unavailable; using 127.0.0.1 as local address
[D 18:26:46.382       client:   74] Searching for 'BITMAP_IMAGE:image'....
[D 18:26:46.382 _broadcaster:   94] (1 of 2) VersionRequest(priority=0, version=13)
[D 18:26:46.382 _broadcaster:   92] (2 of 2) SearchRequest(name='BITMAP_IMAGE:image', cid=36154, version=13, reply=5)
[D 18:26:46.382       client:   88] 0.0.0.0:65515 --->>> 255.255.255.255:5064 2 commands 56B
[D 18:26:46.382 _broadcaster:  136] 0.0.0.0:65515 <<<--- 127.0.0.1:5065 16B RepeaterConfirmResponse(repeater_address='127.0.0.1')
[D 18:26:46.382 _broadcaster:  136] 0.0.0.0:65515 <<<--- 192.168.44.175:5064 16B VersionResponse(version=13)
[D 18:26:46.382 _broadcaster:  136] 0.0.0.0:65515 <<<--- 192.168.44.175:5064 24B SearchResponse(port=5064, ip='255.255.255.255', cid=36154, version=13)
[D 18:26:46.382       client:  148] Found 'BITMAP_IMAGE:image' at 192.168.44.175:5064
[D 18:26:46.398     _circuit:  166] 192.168.44.175:60061 --->>> 192.168.44.175:5064 16B BITMAP_IMAGE:image VersionRequest(priority=0, version=13)
[D 18:26:46.398     _circuit:  166] 192.168.44.175:60061 --->>> 192.168.44.175:5064 32B HostNameRequest(name='DESKTOP-48QMRE8')
[D 18:26:46.398     _circuit:  166] 192.168.44.175:60061 --->>> 192.168.44.175:5064 32B ClientNameRequest(name='AR-VR lab W1')
[D 18:26:46.398     _circuit:  166] 192.168.44.175:60061 --->>> 192.168.44.175:5064 40B BITMAP_IMAGE:image CreateChanRequest(name='BITMAP_IMAGE:image', cid=0, version=13)
[D 18:26:46.398       client:  202] 192.168.44.175:60061 <<<--- 192.168.44.175:5064 16B VersionResponse(version=13)
[D 18:26:46.398       client:  202] 192.168.44.175:60061 <<<--- 192.168.44.175:5064 16B CreateChFailResponse(cid=0)
Traceback (most recent call last):
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 190, in make_channel
    commands = recv(chan.circuit)
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 46, in recv
    bytes_received = sockets[circuit].recv(4096)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\Scripts\caproto-get.exe\__main__.py", line 7, in <module>
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\commandline\get.py", line 172, in main
    response = read(pv_name=pv_name,
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 353, in read
    chan = make_channel(pv_name, udp_sock, priority, timeout)
  File "C:\Users\AR-VR lab W1\AppData\Local\Programs\Python\Python38\lib\site-packages\caproto\sync\client.py", line 194, in make_channel
    raise CaprotoTimeoutError("Timeout while awaiting channel "
caproto._utils.CaprotoTimeoutError: Timeout while awaiting channel creation.

from caproto.

vstadnytskyi-FDA avatar vstadnytskyi-FDA commented on June 12, 2024

I just noticed. my terminal client connects to a different caproto server that is running on the same machine but contains different set of PVs (100% different. Very different prefix, so no way I messed up that). When I closed the other server, I was able to connect to my "BITMAP_IMAGE:image" PV without any errors.

from caproto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.