def __before_termination__(self, sig):
        """
        It will be called when a TERM signal is received, right before
        sys.exit(0)
        """
        print(
            "Ahhhh! I'm going to be killed. My pid:{}, signal received:{}"
            .format(self.pid, sig)
        )

        It will be called when a TERM signal is received, right before
        sys.exit(0)
        
dHydra/Worker/CtpTrader/CtpTrader.py