Jump to content
Drughi

Notification when Houdini crashes

Recommended Posts

Posted (edited)

Hi,

sometimes Houdini crashes while caching out simulations. I would like to trigger an event when it crashes. My idea was to create a subprocess wich checks every 5 Minutes if my sim is running by looking up if Houdinis PID exists. Does that make sense or is there a better way?

Is the subprocess still running even if Houdini has crashed?

I have no experience with subprocesses maybe someone can help me. What i have so far:

import os

pid = os.getpid()

# in subprocess
if os.name == 'posix':
    def pid_exists(pid):
        """Check whether pid exists in the current process table."""
        import errno
        if pid < 0:
            return False
        try:
            os.kill(pid, 0)
        except OSError as e:
            return e.errno == errno.EPERM
        else:
            return True
else:
    def pid_exists(pid):
        import ctypes
        kernel32 = ctypes.windll.kernel32
        SYNCHRONIZE = 0x100000

        process = kernel32.OpenProcess(SYNCHRONIZE, 0, pid)
        if process != 0:
            kernel32.CloseHandle(process)
            return True
        else:
            return False
if not pid_exists(pid):
    # Trigger Event

 

Edited by Drughi

Share this post


Link to post
Share on other sites

You should use a render manager of some kind, Tractor, Deadline, Hqueue etc. Many of them have functionality like this.

The way you're doing it is a bit troublesome. Where are you running this from? If it's from Houdini for obvious reasons it won't work since the program will have crashed.

If it's from some other shell, how will you get the correct pid?

Also, Python is cool so it will work, but your morphing function definition isn't very usual. Usually you would take care of the OS difference inside the function (or have two different functions).

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×