Tagged Questions
1
vote
1answer
47 views
Demonstration of processing a queue of no-op threads
I am creating a script, that will SSH to several hosts, get stuff, parse it and return. Because I wait for server response, I'm using threading.
Real script is ...
2
votes
0answers
21 views
Suspending and resuming threads for Azure bus service
I am new to thread programming in python. I am trying to read message from azure service bus, the message may or may not be present in the queue. So this is the logic I come up with
...
4
votes
1answer
67 views
Find Eulerian Tour Algorithm - with multithreading and random permutations
After struggling for a long while on this through the algorithms course on Udacity, I finally understood enough of the concept to develop this implementation. However, it lacks efficiency and finesse. ...
3
votes
0answers
36 views
Implementing non-blocking Executor.map
I wanted to extend concurrent.futures.Executor to make the map method non-blocking. It seems to work fine, but I would be very ...
1
vote
0answers
42 views
Python multiprocessing with multithreading - processing a list of work
Although this code can be used for many different purposes, I'm building it for use in web-scraping. I would like to know if this is the best approach. Can you see any bugs or potential lockups?
The ...
4
votes
0answers
56 views
Speeding web-scraping up Python 3
I want to get information from two websites and display it on 'real-time' in the console.
To get the information from the website I am using BeautifulSoup 4. I have read, that the bottleneck of ...
1
vote
2answers
47 views
Python script to renew key from Vault every 30s
A small Python lib to renew key from Vault every 30s to always get the latest key.
...
5
votes
1answer
125 views
Speech Recognition Part 2: Classifying Data
Now that I have generated training data, I need to classify each example with a label to train a TensorFlow neural net (first building a suitable dataset). To streamline the process, I wrote this ...
4
votes
0answers
46 views
A GUI program for a Buzzer system using arduino
At the outset, I am a beginner at python, having started out about 2 weeks back.
Aim- To create a GUI program, that can adequately work as a buzzer-management system. A buzzer, like those used in ...
1
vote
2answers
58 views
Search for a filename with keyword
I have a directory with lot of files and folders in it. The function which I wrote works, but I want to make it more efficient and faster. I was thinking of multiprocessing or threading.
The code ...
6
votes
3answers
195 views
Python UDP class to control drone
I'm currently building a small plane with Raspberry Pi Zero W. I wrote a small code which uses UDP to control it.
Here I'm resending packets regularly in a thread because of the joystick input (it ...
4
votes
1answer
87 views
Ping multiple sites via Python
Here is a simple script that I am using to ping 50 sites at a time and check if they are up or not. If not, save the down time with error in MongoDB.
...
5
votes
1answer
325 views
Increase the speed of this python code for text processing
I need to iterate through a file of words and perform tests on them.
...
1
vote
1answer
104 views
IP Scanner via python sockets
Please review my code for scanning active IP address . Please Suggest improvements ...
...
6
votes
1answer
113 views
Simple slack bot in python
I wrote a simple slack bot, which is able to save links (command: "save name link") and print them (command: "get name"). Optionally, a delay in minutes and seconds can be specified (command: "get ...
6
votes
1answer
63 views
Expanding url from shortened url obtained from tweet
I have a twitter data set. I have extracted all the expanded urls from the json and now am trying to resolve the shortened ones. Also, I need to check which urls are still working and only keep those.
...
2
votes
0answers
61 views
Multithreaded chat application in python
I wrote a multithreaded p2p chat application with Qt, and I'm hoping for some feedback. I know there's some deficiencies with error handling, but I'd like to know what else I'm missing. Thanks!
<...
1
vote
1answer
50 views
Did I overuse / underuse threading locks in my custom list class?
I am writing a Python module in which two threads access one list. One thread adds 500 items to the list per second, and the other thread reads the list at an irregular interval. I want to make a ...
2
votes
0answers
66 views
Thread-safe RLockedList
I have written a thread-safe list which can be used as a drop-in replacement for a regular list. This has been tested and used internally without issue, but "The absence of evidence is not evidence of ...
3
votes
0answers
21 views
Python simulacrum of windows copy window
I wrote a program to copy files with an progress bar that looks similar to Windows built in function. The copy function is run in a separate thread and the tkinter GUI is run in the main thread. This ...
3
votes
1answer
80 views
Streaming floating point data in Python2
I am in the process of creating a brain-computer interface, and one task is to stream electroencephalograph (EEG) data into a Python script for real-time analysis. Included in this question are two ...
4
votes
1answer
140 views
Multithreaded Python implementation of a Sudoku validator
I've just come across these day with the multithreading subject in Python. I remembered @200_success's answer and I thought of making that multithreaded as it follows:
one thread to check that each ...
5
votes
2answers
189 views
Parallel quicksort algorithm taking way too long
Below is a Python implementation of the quicksort algorithm using parallelism. It takes about 1 second per every 10 items in the list, which is hilariously unacceptable. Why is it so slow?
...
3
votes
1answer
54 views
Make one greenlet tell another to shutdown
I am building a commandline app to check proxies, which has a daemon flag (running forever or just once).
There are producers, checkers and storers. I want them to run in parallel and be able to ...
6
votes
1answer
167 views
Counting K-mers (words) in a sequence string
I recently found out how to use joblib for parallelization. I want to iterate through this string seq in steps of 1 and count ...
0
votes
1answer
52 views
How to avoid carrying around a lock with my variable when multiple threads instantiation in Python?
I created an application using multiple threads defined in multiple class files which read and write into a "shared variable" (a dictionary).
To ensure thread-safety, I am using a Lock, and I pass it ...
3
votes
1answer
590 views
Sorting seems to be slower with 2 threads instead of 1
I'm implementing a simple merge sort to practice with Python's Threads. I've tried to split the job into two threads, that sort normally, then I can join them and merge the result. However, it takes ...
7
votes
1answer
241 views
Project hotel reservation in Python with OOP and multithreading
I have to create a project in Python 3 for a university exam. The project involves the use of object-oriented programming and the use of multithreading. My project is based on the simulation of ...
1
vote
0answers
99 views
Run a potentially long running application from within a Python webserver and return different results depending on whether the application finishes
I want an API on a Flask/Gunicorn webserver to make a call to a separate, potentially long-running java application. If the java application finishes before the Gunicorn timeout, Flask should return ...
3
votes
1answer
108 views
Simulating memcache get and set race condition and solving it with add
Memcache get and set can hit a race condition if you use them together to achieve something like locking because it is not ...
3
votes
3answers
3k views
Finding the tree height in Python
I'm trying to get an efficient algorithm to calculate the height of a tree in Python for large datasets. The code I have works for small datasets, but takes a long time for really large ones (100,000 ...
2
votes
2answers
48 views
Copy directory to multiple directories - I/O performance matters
I am working on below python copy utility that should work on windows & linux,
But I am looking for a more efficient approach that could optimize my I/O correction, as my target location is ...
1
vote
1answer
187 views
Multi-threading upload tool
We have about 14G files and each is about 150k.
I'm writing a script to upload them to Azure Blob storage and would like to run an upload() function (each with own ...
2
votes
0answers
45 views
Memcached load generation
This is working but right now it is not giving me the throughput that I want. The main function has the load generation loop (where it is putting work in Queue). I ...
0
votes
1answer
90 views
2
votes
0answers
26 views
Adaptive scan of function concurrently
This function try to scan the given function in n dimensions in the given range by adaptively divide the area into n+1 points polygon (e.g. triangle in 2D; tetrahedron in 3D)
I tried to seperate the ...
4
votes
1answer
840 views
Downloading files using Python-requests
I wrote a Python script to download files using multiple (source) IP addresses -- kindly suggest any improvements.
...
13
votes
3answers
5k views
Replacing Skype, reinventing the chat client
I'm creating a chat client and chat server after a several month programming hiatus. The goal is to make one with features I want but it's also a learning project. Although it's mostly because I'm ...
9
votes
2answers
849 views
Command line IRC client
I made this IRC client ages ago in Python, and thought I'd revisit it for Python 3.5 (I'd like to play with asyncio). Before I start, I'd like to have an overall design review about this.
Known ...
4
votes
1answer
353 views
Simple Python chat
I am working on a simple console chat in Python. I started from this Winforms application, removed all the forms (so that the chat could run on Windows and Linux) and did some refactoring (the "click ...
3
votes
1answer
97 views
Synchronization algorithm for deterministic context switching between threads
Curious how sqlite3 would handle different race conditions in a multithreaded environment, I created a simple module called deterministic for serializing the ...
1
vote
1answer
149 views
QuickSort - 3 pivot choosing methods via factory
I'm happy to hear thoughts and ideas on structure/performance/testing/whatever and multi-threading, which I haven't gotten into yet with Python.
Latest code here. Assignment file and a few test files ...
2
votes
1answer
627 views
Inversion count via divide and conquer
I'm happy to hear thoughts and ideas on structure/performance/testing/whatever and multi-threading, which I haven't gotten into yet with Python.
Full code here. Assignment file and a test file ...
6
votes
4answers
3k views
Multithreaded web scraper with proxy and user agent switching
I am trying to improve the performance of my scraper and plug up any possible security leaks (identifying information being revealed).
Ideally, I would like to achieve a performance of 10 pages per ...
5
votes
3answers
962 views
Will multi-threading or other method make my program run faster?
I didn't use multi-threading so far as I didn't need to. But as far as I've read, implementing them will make my program slightly faster than it actually is.
...
3
votes
1answer
276 views
TCP server with user accounts, connection threading, and groups/permissions
This is a TCP server I am currently working on. It is accessed through telnet (I know it isn't secure, its just a project for uni). The server is programmed in Python 3.
I am currently trying to ...
18
votes
1answer
800 views
Messed up Elevator Management System
In light of our current community-challenge I decided to build an Elevator Management System.
Initially I intended to program the EMS like a real-time operating system and the elevators as finite-...
5
votes
2answers
123 views
Downloading list of images
This code downloads a list of images, each in a different thread.
I have some questions about this code:
I don't know how to get information about correcting downloading (sometimes thread just ...
6
votes
1answer
56 views
A tiny module for handling text updates
I call these text updates "Feeds". A Feed object has some basic attributes like its content string, how many lives it has and its priority in the queue. I haven't ...
6
votes
2answers
2k views
Multithreaded Network Server
I would like the following code reviewed:
I am trying to create a local server which listens indefinitely and
provides the latest information. The server runs another while loop
which fetches ...