Comments (5)
@kingspride One of the slightly tricky parts here is that the monitor callback is registered from the main Python loop but is called from "inside" the C-level CA event loop. That puts some subtle limitations on the work that can be done within each callback. One thing that basically cannot be done is to do other CA work, such as creating PVs or checking the connection status of other PVs. You can get other PV values, but those will essentially be the cached values.
So, what I do and recommend often (though I would hesitate to call this "the right way", is to just set a simple global/class-level field in the callback and then do the work such as "start long running task" from the main loop.
Does that make sense?
from pyepics.
okay. usage of global variables are not the "fine english way" as you'd say in german, but I can definitly use it if there is no other option.
from pyepics.
Well, your runner
, run
, worker
, starter
, stopper
, and main
are global variables, and you are using global
throughout your script. Another completely normal approach would be to encapsulate that into a class, and have each of those be attributes/methods of the instance of the object (and then nothing would be global
in your script and instead be owned by self
).
But also, information and data about CA connections do need to be in "per-process" global data. That is done behind the scenes, but it can be useful to keep in mind that there is a single CA event loop running within the C-level CA library.
from pyepics.
sure, but initially I didnt want to use at least the global statement. maybe its just personal taste.
the script above was already a later version where I tried a lot of things (bluesky and ophyd devices dont work inside pyepics multiprocesses... :( )
so yeah...
I'll try to make my way though it with globals / classes and see where I get.
thanks so far :)
from pyepics.
@kingspride well, yeah there is also the question of "multiprocess" is actually what you want, especially in contrast to running multiple processes (ie, launched by the OS).
I can't help with anything related to ophyd/bluesky - I don't use it.
from pyepics.
Related Issues (20)
- How to set DBR type for ca.put()? HOT 5
- Add missing DBR types DBR_STSACK_STRING and DBR_CLASS_NAME HOT 3
- CAC: Unable to connect because "Invalid argument" when using pcaspy with pyepics HOT 8
- pyc files not removed properly from distributions
- Segmentation fault in epics.get_pv for pyepics 3.5.1 HOT 3
- ca.get('image) timed out after 1.00 seconds HOT 1
- pv callback not called when the value of pv changes HOT 9
- libca.so cannot be found on RPi 64bit HOT 3
- The issue of installed pyepics HOT 1
- Review performance testing HOT 10
- text encoding fallback HOT 9
- libca.so: cannot open shared object file HOT 23
- Missing updates from pv monitor when going in/out of an invalid severity HOT 2
- Callback function gets NoneType return value HOT 6
- Application using pyepics may crash after epics.ca.clear_cache() HOT 4
- GitHub worflow tests do no execute on pull-requests
- wrong int format conversion character in pv.pv line 877 HOT 1
- Apple Silicon ARM support for libca.so HOT 1
- Possible race condition in CA channel creation HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyepics.