All Questions
Tagged with python-multithreading concurrency
77 questions
0
votes
1
answer
40
views
Python threads 'starved' by pandas operations
I am creating a UI application with Qt in Python. It performs operations on pandas DataFrames in a separate threading.Thread to keep the UI responsive; no individual pandas instruction takes noticable ...
0
votes
2
answers
178
views
ThreadPoolExecutor too fast for CPU bound task
I'm trying to understand how ThreadPoolExecutor and ProcessPoolExecutors work. My assumption for this test was that CPU-bound tasks such as increasing a counter wouldn't benefit from running on ...
1
vote
1
answer
799
views
Python: Using ThreadPoolExecutor within a Thread
I am using ThreadPoolExecutor within a Thread with this script:
def worker(x):
return x*x
def FncWithinThread():
with ThreadPoolExecutor(10) as executor:
futures_to_data = {executor....
0
votes
1
answer
72
views
How to ask for userinput and do something else at the same time
I am trying to make a simple command line irc client.
I basically want to receive and send messages. The problem is that in the code below the program waits until some input is given, as expected. So ...
1
vote
1
answer
57
views
Threading in python is not running concurrently [duplicate]
from time import sleep
import threading
def sleep_and_print(duration, name):
sleep(duration)
print(name)
t1 = threading.Thread(target=sleep_and_print(2, "three second sleep"))
t2 = ...
0
votes
0
answers
37
views
python threading is stop
I want to make a process like A run in 40ms one time all the way,and it products some datas.Then B need to get the datas to make something and it cost 180ms one time.And I need C to get the solved ...
1
vote
1
answer
911
views
Getting paramiko.ssh_exception.SSHException: key cannot be used for signing in Paramiko while using multithreading
I wrote a simple python script to ssh to a machine run some commands and write to csv.
The script and SSH with Paramiko works fine when it's single thread but when I try to use Multithreaded like so:
...
0
votes
1
answer
449
views
Attempting to run threads concurrently inside while loop in Python 3.11
I am trying to get my head around threading in Python 3.11 and I am trying to work out why when I put a time.sleep(120) inside execute_subtasks that the next thread is not processed and the code ...
2
votes
0
answers
969
views
Use cases for threading and asyncio in python
I've read quite a few articles on threading and asyncio modules in python and the major difference I can seem to draw (correct me if I'm wrong) is that in,
threading: multiple threads can be used to ...
0
votes
1
answer
142
views
How to run threads with django
How to run thread with Django how to send data inside views file
from django.shortcuts import render
from django.http.response import HttpResponse
from datetime import datetime
from .pnet import ...
1
vote
1
answer
4k
views
Asyncio vs Threading in python [duplicate]
I have been using asyncio for a while together with multiprocessing and threading in python. But I'm not sure if i can see the diference between AsyncIO and threading in python.
Python is always ...
0
votes
1
answer
606
views
Python, ThreadPoolExecutor, pool execution doesnt terminate
I have got I simple code modelling a more complicated problem I am to solve. Here I have 3 funcs- worker, task submitter (seek tasks and put it to queue once it gets new ones) and function creating ...
1
vote
1
answer
391
views
Python ThreadPoolExecutor: How to evaluate what caused a timeout
Given the following simple method that causes a TimeoutError at some point. How can I determine what were the conditions (e.g. arguments or something else) that caused the timeout?
In [82]: def f(i):
...
0
votes
3
answers
178
views
How to run multiple threads together in simpler code in Python?
I'm trying to simplify the code of threads below:
import threading
def test1():
print("test1")
def test2():
print('test2')
thread1 = threading.Thread(target=test1)
thread2 = ...
0
votes
3
answers
325
views
Unexpected behavior of Threading.join() - Code between calls to Threading.join()
Does the order of the Threading.join()s in the source code GUARANTEE the order of execution of the threads OR IS IT SIMPLY to ensure that the main thread finishes UNTIL ALL THREADS FINISH?
import ...