Skip to content

pulse

FusionPulse

Bases: QObject

A Timer that checks whether host app is still alive.

This checks whether the Fusion process is still active at a certain interval. This is useful due to how Fusion runs its scripts. Each script runs in its own environment and process (a fusionscript process each). If Fusion would go down and we have a UI process running at the same time then it can happen that the fusionscript.exe will remain running in the background in limbo due to e.g. a Qt interface's QApplication that keeps running infinitely.

Warning

When the host is not detected this will automatically exit the current process.

Source code in client/ayon_fusion/api/pulse.py
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class FusionPulse(QtCore.QObject):
    """A Timer that checks whether host app is still alive.

    This checks whether the Fusion process is still active at a certain
    interval. This is useful due to how Fusion runs its scripts. Each script
    runs in its own environment and process (a `fusionscript` process each).
    If Fusion would go down and we have a UI process running at the same time
    then it can happen that the `fusionscript.exe` will remain running in the
    background in limbo due to e.g. a Qt interface's QApplication that keeps
    running infinitely.

    Warning:
        When the host is not detected this will automatically exit
        the current process.

    """

    def __init__(self, parent=None):
        super(FusionPulse, self).__init__(parent=parent)
        self._thread = PulseThread(parent=self)
        self._thread.no_response.connect(self.on_no_response)

    def on_no_response(self):
        print("Pulse detected no response from Fusion..")
        sys.exit(1)

    def start(self):
        self._thread.start()

    def stop(self):
        self._thread.requestInterruption()