process

Identifying which test case is running on pytest-xdist processes

Identifying which test case is running on pytest-xdist processes Question: I’m executing python unit tests in parallel with pytest-forked (pytest -r sxX -n auto –cache-clear –max-worker-restart=4 –forked) and there is one test case which takes quite some time and which is running at the end while the other test case runners/CPU cores are idle (because …

Total answers: 2

python update variable in loop and use it in another process

python update variable in loop and use it in another process Question: Why while loop is ignored in work1? I would like to update value from string to another value in loop and output this value in process work2. Also already tried with Queue, but problem is I have only one variable which I would …

Total answers: 1

multiprocessing PicklingError in Python 3.6.5 that doesn't occur in 3.6.1

multiprocessing PicklingError in Python 3.6.5 that doesn't occur in 3.6.1 Question: The following code works in Python 3.6.1 … but returns this error in Python 3.6.5: Traceback (most recent call last): File “G:/GOOD/Coding/Deepthroat/Deepthroat2/Bin/Testing/gh.py”, line 36, in <module> loops.start() File “C:Program FilesPython36libmultiprocessingprocess.py”, line 105, in start self._popen = self._Popen(self) File “C:Program FilesPython36libmultiprocessingcontext.py”, line 223, in _Popen …

Total answers: 2

In python how to disable Task Manager?

In python how to disable Task Manager? Question: I tried this code but it didn’t worked: import subprocess from time import sleep si = subprocess.STARTUPINFO() si.dwFlags |= subprocess.STARTF_USESHOWWINDOW while True: subprocess.call(“taskkill /F /IM Taskmgr.exe”, startupinfo=si) sleep(1) ERROR: The process “Taskmgr.exe” with PID 5220 could not be terminated. Reason : Access denied. Asked By: Wyren || …

Total answers: 3

Python: running multiple processes simultaneously

running multiple processes simultaneously Question: I am attempting to create a program in python that runs multiple instances (15) of a function simultaneously over different processors. I have been researching this, and have the below program set up using the Process tool from multiprocessing. Unfortunately, the program executes each instance of the function sequentially (it …

Total answers: 3

using WIN32 API CreateProcessAsUser in Python

using WIN32 API CreateProcessAsUser in Python Question: I have been trying to find a good example of how to use the CreateProcessAsUser() WIN32 API in Python along side the LogonUser() API, but to no avail. Any help on this would be greatly appreciated. Asked By: William Troup || Source Answers: First, you should know that …

Total answers: 1

python multiprocessing – process hangs on join for large queue

python multiprocessing – process hangs on join for large queue Question: I’m running python 2.7.3 and I noticed the following strange behavior. Consider this minimal example: from multiprocessing import Process, Queue def foo(qin, qout): while True: bar = qin.get() if bar is None: break qout.put({‘bar’: bar}) if __name__ == ‘__main__’: import sys qin = Queue() …

Total answers: 4

What are the differences between the threading and multiprocessing modules?

What are the differences between the threading and multiprocessing modules? Question: I am learning how to use the threading and the multiprocessing modules in Python to run certain operations in parallel and speed up my code. I am finding this hard (maybe because I don’t have any theoretical background about it) to understand what the …

Total answers: 7

How to terminate process from Python using pid?

How to terminate process from Python using pid? Question: I’m trying to write some short script in python which would start another python code in subprocess if is not already started else terminate terminal & app (Linux). So it looks like: #!/usr/bin/python from subprocess import Popen text_file = open(“.proc”, “rb”) dat = text_file.read() text_file.close() def …

Total answers: 3

How to Communicate with a Chess engine in Python?

How to Communicate with a Chess engine in Python? Question: On Windows 7 I can communicate with a chess engine via command line. Small example session with Stockfish on Win 7: C:runStockfish>stockfish-x64.exe Stockfish 2.2.2 JA SSE42 by Tord Romstad, Marco Costalba and Joona Kiiski quit C:runStockfish> The first line was output by the engine and …

Total answers: 3