Home > other >  Python multithreading
Python multithreading

Time:09-22

I do automation test framework, can create four threads execute scripts and a Log threads, each thread script execution will use subprocess. The Popen perform a large number of scripts, and handling stdout and stderr information, will Log passed to the Log queue thread, the Log thread is in the infinite loop continuously take the things in the queue, then process, each query queue. There will be time sleep (0.5), and other four threads execute the script after the execution, will automatically quit the infinite loop,

About the code is as follows:
MultiThread. Py


MainEntrance. Py


Phenomenon is, I through SSH connected to the PC, the main operation, program run to a half SSH is broken,
Then I SSH two instances, a main operation, with a top view process information, the PC remote SSH is broken again, and the local two SSH is disconnected at the same time,
Test for many times, every broken time is not the same as
Now suspect is popen preempted the PC resource, which leads to the SSH service, but doesn't make sense, so want to ask next everybody a great god, and I code if there is a problem, thank
  • Related