Python multi-threading

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
sshah254
Posts: 2
Joined: Sat Nov 09, 2019 1:25 am

Python multi-threading

Post by sshah254 »

Hi,

I have a python script that launches multiple threads. "Everything" client is running, and each thread calls this client to make queries for files / folders specific to that thread.

Will this setup work such that each thread gets its own results from "everything"? Or should I just limit this to 1 thread, and call it multiple times?

Thanks,

Sandip
void
Developer
Posts: 15351
Joined: Fri Oct 16, 2009 11:31 pm

Re: Python multi-threading

Post by void »

The Everything SDK/IPC is currently designed for 1 thread.

Everything will only perform one query at a time.
Executing a query will block until the any other query from another thread completes.

A single Everything query will use all available CPUs.
Will this setup work such that each thread gets its own results from "everything"? Or should I just limit this to 1 thread, and call it multiple times?
It's up to you, I would leave it threaded for now as I may add support for multiple queries in a future release.
sshah254
Posts: 2
Joined: Sat Nov 09, 2019 1:25 am

Re: Python multi-threading

Post by sshah254 »

Hi,

Thanks for the response.

I have left it as single threaded, since, with multi-threading, I was getting weird responses.

My code (Python) is -

search_for = r'%s folder: child:StoryBoard_*.txt' % (self._src_dir.upper().replace(r'U:', r'T:\RUNDATA'))

essentially, it should return a folder name to me if it contains a file StoryBoard*.txt

Single threaded, for two sample folders, it returns a value of "20" and "992" ... and each of those folders can be listed.

But for 2 threads, it returns 20 folders that can be listed, and the other 992 and all "" (blanks).

let me know if you want to debug this further, else I am ok with the solution as it is for now.

Sandip
Post Reply