Skip to content

Fix missing root path for example.#70

Merged
JeanLucPons merged 1 commit intomainfrom
examples
Nov 14, 2025
Merged

Fix missing root path for example.#70
JeanLucPons merged 1 commit intomainfrom
examples

Conversation

@TeresiaOlsson
Copy link
Copy Markdown
Contributor

@TeresiaOlsson TeresiaOlsson commented Nov 13, 2025

I have added the root path to the esrf_tune_example_no_yaml.py example since without it the csv files aren't found when running the example.

However, the example still doesn't work. I get the following error which I guess is because the devices try to connect to TANGO devices that don't exist.

PyAMLException: API_CorbaException: TRANSIENT CORBA system exception: TRANSIENT_NoUsableProfile Origin: void Tango::Connection::connect(const string&) at (/src/cppTango/src/client/devapi_base.cpp:635) Severity: ERR

@gubaidulinvadim
Copy link
Copy Markdown
Contributor

Hi Teresia,

There's some conflict between pytango and tango-pyaml sometimes. Try to do your test in a pip environment where you only have tango-pyaml. Tango-pyaml module is required for tests and it install a dummy control system that emulates TANGO in a simple way. So, you do not need to have an actual control system to run unit tests.

@TeresiaOlsson
Copy link
Copy Markdown
Contributor Author

But this example isn't a unit test? It's just a script in the examples folder. I run it a virtual environment where I only have pyaml and tango-pyaml and their required dependencies. Shouldn't the script then be possible to run?

@gubaidulinvadim
Copy link
Copy Markdown
Contributor

gubaidulinvadim commented Nov 13, 2025

Yes, it should work then. But you might need to install the dummy-cs package from tests/ folder to emulate tango. I think it is only installed during the pytest runs.

@TeresiaOlsson
Copy link
Copy Markdown
Contributor Author

Okay, but then I think the example is clearly showing the problem with how the configuration layer is implemented at the moment. There shouldn't be any need to emulate the control system if you just want to create the configuration by creating objects of the config classes yourself instead of reading them in from a yaml file. For me that's part of the point of having config classes. If they can't be used like that they just double the number of classes to maintain without adding much benefit.

@gubaidulinvadim
Copy link
Copy Markdown
Contributor

gubaidulinvadim commented Nov 13, 2025

But we know this (needing a control system to initialise pyaml) already. There are two open issues on it: #28 and #26.

@TeresiaOlsson
Copy link
Copy Markdown
Contributor Author

Okay. I thought the purpose of the example was to show that what I want to be able to do can already be done with the current implementation.

@TeresiaOlsson
Copy link
Copy Markdown
Contributor Author

The pull request #71 aims to solve issue #28. Issue #26 I think is easiest solved by switching to ophyd-async since the functionality already exist there.

@gubaidulinvadim
Copy link
Copy Markdown
Contributor

Maybe I wasn't clear. Your error stems from the fact that currently, we need a control system initialisation step when loading the configuration. If you want to initialise only the simulator part, I think that, currently, it is not possible. The dummy-cs control system is meant to be used for unit tests and CI/CD, which is very useful. The alternative to test CS-part is to use some kind of digital twin for a specific lattice. I think this is less practical. If you want to test things locally, without any kind of digital twin, this is also possible if you install a dummy-cs control system. One or two weeks ago, I also modified the README.md of pyaml to reflect this. Otherwise, pyAML tries to reach tango-host, which does not exist on your local computer.

The mentioned issues will be addressed, but we only have part-time people working on the project and only very few. So, the issues cannot be resolved instantly. This is why I always encourage people to contribute and to participate in discussions -- to identify issues and resources to solve them.

@TeresiaOlsson
Copy link
Copy Markdown
Contributor Author

I understood. My point was that ophyd-async already has a lot of the functionality we need (including this) so instead of spending resources on implementing our own solution we should switch to using that and we will have access to support from the large team of developers they have.

@JeanLucPons
Copy link
Copy Markdown
Contributor

For me your patch is ok:

[ubuntu20acu.pons] > python esrf_tune_example_no_yaml.py
Tango control system binding for PyAML was already initialized with name 'live' and TANGO_HOST=ebs-simu-3:10000
Tune=Value(0.2921267341037133, quality='VALID', timestamp='2025-11-14 07:07:14.607817'), Value(0.40879552981619777, quality='VALID', timestamp='2025-11-14 07:07:14.608263')
Tune=Value(0.38952758430038753, quality='VALID', timestamp='2025-11-14 07:07:17.672885'), Value(0.3614632411496573, quality='VALID', timestamp='2025-11-14 07:07:17.673515')

To use without control system:

[ubuntu20acu.pons] > pwd
/home/esrf/pons/pyaml
[ubuntu20acu.pons] > pip install tests/dummy_cs/tango-pyaml
[ubuntu20acu.pons] > cd examples/ESRF_tune_example/
[ubuntu20acu.pons] > python esrf_tune_example_no_yaml.py
Creating dummy TangoControlSystem: live
Tune=Value(0.0, quality='VALID', timestamp='2025-11-14 07:10:21.813228'), Value(0.0, quality='VALID', timestamp='2025-11-14 07:10:21.813282')
MultiAttribute.get(4 values)
MultiAttribute.get(4 values)
MultiAttribute.set(4 values)
Tune=Value(0.0, quality='VALID', timestamp='2025-11-14 07:10:24.813651'), Value(0.0, quality='VALID', timestamp='2025-11-14 07:10:24.813730')

@JeanLucPons JeanLucPons merged commit bdf1a72 into main Nov 14, 2025
2 checks passed
@gubaidulinvadim gubaidulinvadim deleted the examples branch November 25, 2025 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants