Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try new upstream typing #41

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

Tom-Willemsen
Copy link
Contributor

@Tom-Willemsen Tom-Willemsen commented Oct 22, 2024

We'll need this after bluesky/ophyd-async#594 gets merged and released upstream - draft PR at the moment.

Current issues:

Fails pyright

(.venv) c:\Instrument\dev\ibex_bluesky_core>pyright
c:\Instrument\dev\ibex_bluesky_core\tests\devices\test_block.py
  c:\Instrument\dev\ibex_bluesky_core\tests\devices\test_block.py:288:31 - error: Argument of type "float" cannot be assigned to parameter "args" of type "Tuple[Movable | NamedMovable | Any, ...]" in function "mv"
    "float" is not assignable to "Tuple[Movable | NamedMovable | Any, ...]" (reportArgumentType)
c:\Instrument\dev\ibex_bluesky_core\tests\devices\test_dae.py
  c:\Instrument\dev\ibex_bluesky_core\tests\devices\test_dae.py:943:15 - error: Argument of type "DaeSettings" cannot be assigned to parameter "args" of type "Tuple[Movable | NamedMovable | Any, ...]" in function "mv"
    "DaeSettings" is not assignable to "Tuple[Movable | NamedMovable | Any, ...]" (reportArgumentType)
  c:\Instrument\dev\ibex_bluesky_core\tests\devices\test_dae.py:943:33 - error: Argument of type "DaeSettingsData" cannot be assigned to parameter "args" of type "Tuple[Movable | NamedMovable | Any, ...]" in function "mv"
    "DaeSettingsData" is not assignable to "Tuple[Movable | NamedMovable | Any, ...]" (reportArgumentType)
3 errors, 0 warnings, 0 informations

My assumption is that's an upstream bug that will be fixed before they release the new typing.

trigger with no timeout seems broken? (fixed)

await dae.controls.end_run.trigger(wait=True, timeout=None) causes the following error, despite the fact that it should be waiting with no timeout:

Traceback (most recent call last):
  File "C:\Instrument\dev\ibex_bluesky_core\src\ibex_bluesky_core\devices\simpledae\__init__.py", line 82, in trigger
    await self.controller.stop_counting(self)
  File "C:\Instrument\dev\ibex_bluesky_core\src\ibex_bluesky_core\devices\simpledae\controllers.py", line 130, in stop_counting
    await _end_or_abort_run(dae, self._save_run)
  File "C:\Instrument\dev\ibex_bluesky_core\src\ibex_bluesky_core\devices\simpledae\controllers.py", line 22, in _end_or_abort_run
    await dae.controls.end_run.trigger(wait=True, timeout=None)
  File "c:\Instrument\dev\ibex_bluesky_core\.venv\Lib\site-packages\ophyd_async\core\_signal.py", line 262, in trigger
    await _wait_for(self._connector.backend.put(None, wait=wait), timeout, source)
  File "c:\Instrument\dev\ibex_bluesky_core\.venv\Lib\site-packages\ophyd_async\core\_signal.py", line 37, in _wait_for
    return await asyncio.wait_for(coro, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\INSTRU~1\Apps\Python3\Lib\asyncio\tasks.py", line 452, in wait_for
    return await fut
           ^^^^^^^^^
  File "c:\Instrument\dev\ibex_bluesky_core\.venv\Lib\site-packages\ophyd_async\epics\signal\_aioca.py", line 283, in put
    await caput(
  File "c:\Instrument\dev\ibex_bluesky_core\.venv\Lib\site-packages\aioca\_catools.py", line 126, in call_wrapper
    return await throw_wrapper(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Instrument\dev\ibex_bluesky_core\.venv\Lib\site-packages\aioca\_catools.py", line 108, in throw_wrapper
    return await awaitable
           ^^^^^^^^^^^^^^^
  File "c:\Instrument\dev\ibex_bluesky_core\.venv\Lib\site-packages\aioca\_catools.py", line 156, in ca_timeout
    raise CANothing(name, cadef.ECA_TIMEOUT) from e
aioca._catools.CANothing: TE:NDW2922:DAE:ENDRUN: User specified timeout on IO operation expired

@Tom-Willemsen Tom-Willemsen changed the title Comply with new upstream typing Try new upstream typing Oct 22, 2024
@coretl
Copy link

coretl commented Oct 22, 2024

Fails pyright

That is bluesky/bluesky#1809 which @dperl-dls is working on

trigger with no timeout seems broken?

Oops, I moved the timeout code into Signal, but forgot to turn it off in aioca. Just pushed a commit that fixes.

@Tom-Willemsen
Copy link
Contributor Author

Thanks @coretl - can confirm our tests are happier r.e. timeouts after bluesky/ophyd-async@1f288ee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants