PyTango Device Servers are not managed with Starter/Astor under Windows
|
|
---|---|
Hello, I want to manage PyTango Device Servers (DS) with Starter DS under Windows 10. The subject had already been discussed on the forum (for example here — https://www.tango-controls.org/community/forum/c/development/python/python-and-astor/ ). However, I still did not find a clear answer. Also, the subject is not covered in the official guide. ——————– All Tango stuff are running under Windows 10 x64: 1. TangoSetup-9.2.2_win64.exe including: 1.1 TangoTest.exe 1.2 Starter.exe (StartDsPath = C:\Tango\DeviceServers) 2. Python 3.8.8 (conda) 2.1 PyTango 9.3.3 (pip) C:\Tango\DeviceServers\TangoTest.exe are fully managed with Starter (start/restart/etc). But PyTango Device Servers are not. What does it mean: 1. When I started PyTango DS manually (python DS.py) I can see "green" state in Astor or server name are listed in the response to the direct query to Starter DS (DevGetRunningServers command) 2. I can to kill running PyTango DS with Astor/direct query to Starter. 3. But I can't start PyTango DS with Astor/direct query to Starter ("red" state). And I can't restart it too (killed ok, but can't started after) My test PyTango Device Servers for Windows environment (see code below): 1. C:\Tango\DeviceServers\PowerSupply.py 2. C:\Tango\DeviceServers\PowerSupply.bat (script launcher for Windows env). Starter logs at C:\Temp doesn't provide any useful info. Is there any ideas? What else would you recommend to check? ——————– Test PyTango Device Server C:\Tango\DeviceServers\PowerSupply.py
C:\Tango\DeviceServers\PowerSupply.bat (Launcher)
|
|
|
---|---|
We are successfully using PyTango and Astor on Windows 10 + Anaconda Python, so I'm confident you can solve your issue. It must be related to the different PATH settings of your user and the SYSTEM account under which the nssm service is run (or other user if you chose so). For it to simply work, it is important that `python` can be found on the PATH also when running inside the starter service. Here is an example batch file just like yours (%* appends all arguments, not just the first when e.g. adding -v4 debug option):
It should work like that if you install Anaconda/Python for the entire system:
If you plan to use multiple environment or otherwise have reasons not to have anaconda on system PATH, this here works on a different lab computer where I think anaconda is not on PATH:
To check what might be going wrong, I suggest to replace the contents of your `PowerSupply.bat` with:
Then you can see if python can be found, if CONDA_ env vars are defined correctly, and finally if anything is going wrong during the starting of your python script (like packages not being loaded because of missing "conda activate" or permissions etc.). The `2>&1` redirects both stdout and stderr to the file. The reason for absolute paths is because I believe Starter will set the working directory as `C:\temp\ds.log\` or so and to avoid needing to search around we set an absolute path. |