Multiprocessing over PyTango
|
|
---|---|
Hi all, here is the new trouble shoot we met while migrating our project 'ExTra' from Tango V8 to V9 (see previous post) we got trouble with multiprocessing programming using multiprocessing python module. While it worked with previous version, now we ran into this error : "terminate called after throwing an instance of 'omni_thread_fatal'", just by executing this piece of code within a DS :
Basicaaly, the code won't crash, it is simply executed on a single processor (and moreover not fully loaded). I would add that the same code executed outside of a DS works correctly. Do you have any tips ? Is it due to the way DS process are executed ? Sorry but I could not search into existing posts… The search service fails for some reasons… In the worst case, what could be the other way to execute parallel threads within a DS ? Many thanks Stephane |
|
|
---|---|
Hi Stephane Can you provide a complete example? I could not reproduce the problem using the latest PyTango (development branch) with Python 3.6.8, and cppTango 9.3.2. Also tried with PyTango 9.2.5 on Python 2.7, and cppTango 9.2.5. The docs have some notes on multiprocessing on the client side. Maybe they apply to the server too? You could try that (although you need at least PyTango 9.3.0) https://pytango.readthedocs.io/en/v9.3.0/howto.html#using-clients-with-multiprocessing I added your lines to the ClockDS.py example from PyTango:
Results of a run, pushing Ctrl+c at the end to exit:
|
|
|
---|---|
Hi Anton, thank you for your reply. Forget the error 'omni_thread_fatal' for a while (it might be due to omniORB library versions… ) because it is not correlated with the main problem. Let's just focus on Multiprocessing piece of code that should work… We have investigated a bit more to understand what goes wrong. Acually, it deals with the Base class device inherited by the DS. On the first hand, let's consider your example that we slightly modified to involve a real multiprocessing code (please see first file Device_Clock.py and command ctime). So DS is based on class 'Device', and actually works correctly. Here is the output when we launch the DS and call the command 'ctime' :
Now, on the second hand, we used Pogo to generate the same kind of DS. But this time, as Pogo made it, it is based on Device_4Impl (please see second file Device4Impl_Clock.py). Unfortunately this one won't work on Tango9. As you can see on output it stucked :
We are pretty sure that multiprocessing is not started at all, since no load is noticed on processors. Please also note that the same DS used to work on Tango8. Our configuration is Ubuntu 18.04, Tango 9.2.5a, Python 3.6.8 and PyTango 9.3.0 What do you think of the difference between these 2 DS ? Many thanks for your help. Stephane |
|
|
---|---|
Dear Anton, good news !! we finally also tried to update the omniORB4 lib from version 4.1.6 to 4.2.3; It solved both the error message and the multiprocessing feature !! Now everything is fine. Thanks anyway for your support. Stephane |
|
|
---|---|
Hi Stephane Glad to hear you have found a solution for your problem. > What do you think of the difference between these 2 DS ? In PyTango, if a device server inherits from `Device`, then it automatically gets the latest version of the implementation (that PyTango knows about). PyTango 9.3.0 would use `Device_5Impl` instead of `Device_4Impl`. I'm not sure why that made a difference to the multiprocessing. POGO has two Python code generation options. The PythonHL option does use `Device`, and the high level API, which I find much easier to use. Regards, Anton |
|
|
---|---|
Hi Anton, I'm back from vacation… thank you for this information that I'll keep in mind. Cheers, Stephane |