コード例 #1
0
ファイル: test_atexit.py プロジェクト: goodspark/dd-trace-py
def test_register():
    def foobar():
        pass

    atexit.register(foobar)
    atexit.unregister(foobar)
    atexit.unregister(foobar)
コード例 #2
0
ファイル: test_atexit.py プロジェクト: goodspark/dd-trace-py
def test_prog_unregister():
    from ddtrace.internal import atexit

    def foobar():
        print("hello")

    atexit.register(foobar)
    atexit.unregister(foobar)
コード例 #3
0
    def stop(self, flush=True):
        """Stop the profiler.

        :param flush: Flush last profile.
        """
        atexit.unregister(self.stop)
        try:
            self._profiler.stop(flush)
        except service.ServiceStatusError:
            # Not a best practice, but for backward API compatibility that allowed to call `stop` multiple times.
            pass