Python Forum
Newb Question - Threading in Crons - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Newb Question - Threading in Crons (/thread-11672.html)



Newb Question - Threading in Crons - vvarrior - Jul-20-2018

I have been attempting to implement threading in an application I'm working on and I'm starting to wonder if I even need it.

I run python 2.7 on raspberry pi zero. For the last couple of days I have been attempting to get a function to be executed in a multiprocess thread so other operations in python aren't halted. The function is executed in a script file from a cronjob.

The function changes a GPIO pin, then fives minutes later, changes it back. When I am testing the script through file in python interpreter, the script pauses for five minutes, then changes the pin back. This seems like it would halt all other python execution on the machine. If the script file is run from a cronjob, however, are all other python scripting processes halted or does each cronjob execute it's own python thread?

I tried searching for the answer but all of the results have to do with manipulating cronjob using python.


RE: Newb Question - Threading in Crons - gontajones - Jul-20-2018

Every cronjob will start a new python interpreter process and run the pointed script.
So it will not halt other python scripts.


RE: Newb Question - Threading in Crons - vvarrior - Jul-20-2018

Thanks for confirmation, I was pretty sure after I pondered on the subject that was the case.