Search code examples
pythonpollingremote-server

Invoke a python script on a remote server and poll the status


I'm looking for a best way to invoke a python script on a remote server and poll the status and fetch the output. It is preferable for me to have this implementation also in python. The python script takes a very long time to execute and I want to poll the status intermediately on what all actions are being performed. Any suggestions?


Solution

  • There are so many options. 'Polling' is generally a bad idea, as it assumes CPU occupation.

    • You could have your script send you status changes.

    • You could have your script write it's actual status into a (remote) file (wither overwriting or appending to a log file) and you can look into that file. This is probably the easiest way. You can monitor the file with tail -f file over the link

    • And many more - and more complicated - other options.