hou.hipFile.load() in multiple threads

   2584   4   0
User Avatar
Member
12 posts
Joined: Dec. 2011
Offline
question, has anyone tried to run muiltiple instances of hou.hipFile.load() in individual threads, outside houdini?
Whatever I do, it shares the same hipFile accross all my threads

cheers
Lead FX TD - Weta Digital
User Avatar
Member
2540 posts
Joined: June 2008
Offline
If your using python I believe you really only have a single thread.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
User Avatar
Member
12 posts
Joined: Dec. 2011
Offline
I have my thread Class that loads a hipfile

class GetNodesThread(QtCore.QThread):

send_node = QtCore.pyqtSignal(object)

def __init__(self, file, parent, v):
self.m_file = file
…..


def run(self):
hou.hipFile.load(self.m_file)
and then in my main script create 1 thread for each file

#Thread 1
thread1 = HThreads.GetNodesThread(self.m_file1, self, 1)
#thread1.send_node.connect(lambda x: self.getObjLists(1, x))
self.m_threads.append(thread1)


#Thread 2
thread2 = HThreads.GetNodesThread(self.m_file2, self, 2)
#thread2.send_node.connect(lambda y: self.getObjLists(2, y))
self.m_threads.append(thread2)


#Start threads
for thread in self.m_threads:
thread.start()

I have some additional debugging code writing out information regarding the loaded files and this is what happens

/path/to/the/hipfile - loaded_hipefile

Thread 1:
Pre load
Zdevel/python/hipfile_diff_check/hip/sphere_v1.hip - untitled.hip

Loaded
Zdevel/python/hipfile_diff_check/hip/sphere_v1.hip - sphere_v2.hip
Wrong file



Thread 2:
Pre load
Zdevel/python/hipfile_diff_check/hip/sphere_v2.hip - untitled.hip

Loaded
Zdevel/python/hipfile_diff_check/hip/sphere_v2.hip - sphere_v2.hip
Correct file
Lead FX TD - Weta Digital
User Avatar
Member
23 posts
Joined: Sept. 2015
Offline
Have you tried with the multiprocessing lib instead ?

https://docs.python.org/2/library/multiprocessing.html [docs.python.org]
http://cgtoolbox.com/ [cgtoolbox.com] Houdini tools and scripts for free ! :)
User Avatar
Member
12 posts
Joined: Dec. 2011
Offline
it wouldn't change anything, the result would still be the same
Lead FX TD - Weta Digital
  • Quick Links