當前位置: 首頁>>代碼示例>>Python>>正文


Python signal.SIGABRT屬性代碼示例

本文整理匯總了Python中signal.SIGABRT屬性的典型用法代碼示例。如果您正苦於以下問題:Python signal.SIGABRT屬性的具體用法?Python signal.SIGABRT怎麽用?Python signal.SIGABRT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在signal的用法示例。


在下文中一共展示了signal.SIGABRT屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: termination_handler

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def termination_handler():
        """
        Exit Ctrl-Z handler
        :return: None
        """

        def kill_process(signum, frame):
            """
            Kill process os signal
            :param int signum: signal code
            :param object frame: frame object
            :return: None
            """

            del signum
            del frame

            os.kill(os.getpid(), signal.SIGTERM)

        sig = getattr(signal, 'SIGTSTP', signal.SIGABRT)
        signal.signal(sig, kill_process) 
開發者ID:stanislav-web,項目名稱:OpenDoor,代碼行數:23,代碼來源:process.py

示例2: murder_workers

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def murder_workers(self):
        """\
        Kill unused/idle workers
        """
        if not self.timeout:
            return
        workers = list(self.WORKERS.items())
        for (pid, worker) in workers:
            try:
                if time.time() - worker.tmp.last_update() <= self.timeout:
                    continue
            except (OSError, ValueError):
                continue

            if not worker.aborted:
                self.log.critical("WORKER TIMEOUT (pid:%s)", pid)
                worker.aborted = True
                self.kill_worker(pid, signal.SIGABRT)
            else:
                self.kill_worker(pid, signal.SIGKILL) 
開發者ID:jpush,項目名稱:jbox,代碼行數:22,代碼來源:arbiter.py

示例3: test_issue9324

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def test_issue9324(self):
        # Updated for issue #10003, adding SIGBREAK
        handler = lambda x, y: None
        checked = set()
        for sig in (signal.SIGABRT, signal.SIGBREAK, signal.SIGFPE,
                    signal.SIGILL, signal.SIGINT, signal.SIGSEGV,
                    signal.SIGTERM):
            # Set and then reset a handler for signals that work on windows.
            # Issue #18396, only for signals without a C-level handler.
            if signal.getsignal(sig) is not None:
                signal.signal(sig, signal.signal(sig, handler))
                checked.add(sig)
        # Issue #18396: Ensure the above loop at least tested *something*
        self.assertTrue(checked)

        with self.assertRaises(ValueError):
            signal.signal(-1, handler)

        with self.assertRaises(ValueError):
            signal.signal(7, handler) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:22,代碼來源:test_signal.py

示例4: idle

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def idle(self, stop_signals=(SIGINT, SIGTERM, SIGABRT)):
        """Blocks until one of the signals are received and stops the updater.

        Args:
            stop_signals (:obj:`iterable`): Iterable containing signals from the signal module that
                should be subscribed to. Updater.stop() will be called on receiving one of those
                signals. Defaults to (``SIGINT``, ``SIGTERM``, ``SIGABRT``).

        """
        for sig in stop_signals:
            signal(sig, self.signal_handler)

        self.is_idle = True

        while self.is_idle:
            sleep(1) 
開發者ID:cbrgm,項目名稱:telegram-robot-rss,代碼行數:18,代碼來源:updater.py

示例5: _install_signal_handlers

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def _install_signal_handlers(self):
        """Install signal handlers for the process.
        """

        self._log.info('Installing signal handlers')

        def handler(signum, _):
            """Signal handler.
            """

            self._log.info('Got signal %s', signum)
            self._stop_event.set()

        for sig in (signal.SIGHUP, signal.SIGINT, signal.SIGTERM,
                    signal.SIGQUIT, signal.SIGABRT):

            signal.signal(sig, handler) 
開發者ID:ActiveState,項目名稱:code,代碼行數:19,代碼來源:recipe-579074.py

示例6: init_signals

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def init_signals(self) -> None:
        # Set up signals through the event loop API.

        self.loop.add_signal_handler(signal.SIGQUIT, self.handle_quit,
                                     signal.SIGQUIT, None)

        self.loop.add_signal_handler(signal.SIGTERM, self.handle_exit,
                                     signal.SIGTERM, None)

        self.loop.add_signal_handler(signal.SIGINT, self.handle_quit,
                                     signal.SIGINT, None)

        self.loop.add_signal_handler(signal.SIGWINCH, self.handle_winch,
                                     signal.SIGWINCH, None)

        self.loop.add_signal_handler(signal.SIGUSR1, self.handle_usr1,
                                     signal.SIGUSR1, None)

        self.loop.add_signal_handler(signal.SIGABRT, self.handle_abort,
                                     signal.SIGABRT, None)

        # Don't let SIGTERM and SIGUSR1 disturb active requests
        # by interrupting system calls
        signal.siginterrupt(signal.SIGTERM, False)
        signal.siginterrupt(signal.SIGUSR1, False) 
開發者ID:TouwaStar,項目名稱:Galaxy_Plugin_Bethesda,代碼行數:27,代碼來源:worker.py

示例7: murder_workers

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def murder_workers(self):
        """\
        Kill unused/idle workers
        """
        if not self.timeout:
            return
        workers = list(self.WORKERS.items())
        for (pid, worker) in workers:
            try:
                if time.time() - worker.tmp.last_update() <= self.timeout:
                    continue
            except ValueError:
                continue

            if not worker.aborted:
                self.log.critical("WORKER TIMEOUT (pid:%s)", pid)
                worker.aborted = True
                self.kill_worker(pid, signal.SIGABRT)
            else:
                self.kill_worker(pid, signal.SIGKILL) 
開發者ID:chalasr,項目名稱:Flask-P2P,代碼行數:22,代碼來源:arbiter.py

示例8: _default_handler

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def _default_handler(signum, *args):
        ''' The default signal handler. Don't register with built-in
        signal.signal! This needs to be used on the subprocess await
        death workaround.
        '''
        # All valid cpython windows signals
        sigs = {
            signal.SIGABRT: SIGABRT,
            # signal.SIGFPE: 'fpe', # Don't catch this
            # signal.SIGSEGV: 'segv', # Don't catch this
            # signal.SIGILL: 'illegal', # Don't catch this
            signal.SIGINT: SIGINT,
            signal.SIGTERM: SIGTERM,
            # Note that signal.CTRL_C_EVENT and signal.CTRL_BREAK_EVENT are
            # converted to SIGINT in _await_signal
        }
        
        try:
            exc = sigs[signum]
        except KeyError:
            exc = DaemonikerSignal
            
        _sketch_raise_in_main(exc) 
開發者ID:Muterra,項目名稱:py_daemoniker,代碼行數:25,代碼來源:_signals_windows.py

示例9: _default_handler

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def _default_handler(signum, *args):
        ''' The default signal handler for Unix.
        '''
        # Just parallel the sighandlers that are available in Windows, because
        # it is definitely the limiting factor here
        sigs = {
            signal.SIGABRT: SIGABRT,
            signal.SIGINT: SIGINT,
            signal.SIGTERM: SIGTERM,
        }
        
        try:
            exc = sigs[signum]
        except KeyError:
            exc = DaemonikerSignal
            
        raise exc() 
開發者ID:Muterra,項目名稱:py_daemoniker,代碼行數:19,代碼來源:_signals_unix.py

示例10: _onexit_signal

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def _onexit_signal(signum, stackframe):
    from signal import SIGABRT, SIGTERM, signal, SIG_DFL

    abort = _callback_dict.pop('abort', None)
    term = _callback_dict.pop('term', None)

    _call_callbacks()

    if signum == SIGABRT and abort is not None:
        try:
            signal(SIGABRT, abort)
        except:
            signal(SIGABRT, SIG_DFL)
    elif signum == SIGTERM and term is not None:
        try:
            signal(SIGTERM, term)
        except:
            signal(SIGTERM, SIG_DFL)
    else:
        signal(SIGABRT, SIG_DFL)
    raise SystemExit(signum)

# delete register from module 
開發者ID:pylada,項目名稱:pylada-light,代碼行數:25,代碼來源:onexit.py

示例11: idle

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def idle(self, stop_signals=(SIGINT, SIGTERM, SIGABRT)):
        """
        Blocks until one of the signals are received and stops the updater.
        Thanks to the python-telegram-bot developers - https://github.com/python-telegram-bot/python-telegram-bot/blob/2cde878d1e5e0bb552aaf41d5ab5df695ec4addb/telegram/ext/updater.py#L514-L529
        :param stop_signals: The signals to which the code reacts to
        """
        self.is_idle = True
        self.logger.info("In Idle!")

        for sig in stop_signals:
            signal(sig, self.signal_handler)

        while self.is_idle:
            if self.__exception_event.is_set():
                self.logger.warning("An exception occurred. Calling exception handlers and going down!")
                for handler in self.error_handlers:
                    # call the error handlers in case of an exception
                    handler()
                self.is_idle = False
                self.stop()
                return

            sleep(1) 
開發者ID:d-Rickyy-b,項目名稱:pastepwn,代碼行數:25,代碼來源:pastepwn.py

示例12: __init__

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def __init__(self, _args=None) -> None:
        super().__init__()
        self.windowTitleChanged.connect(self.on_windowTitleChanged)
        with open_in_directory_of(__file__, "mainwindow.ui") as file:
            uic.loadUi(file, self, package="application.ui")

        for sig in (signal.SIGABRT, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM):
            signal.signal(sig, lambda signal, frame: self.handle_signal(signal))

        # catch the interpreter every now and then to be able to catch signals
        self.idle_timer = QtCore.QTimer()
        self.idle_timer.timeout.connect(lambda: None)
        self.idle_timer.start(200)

        log().info("app dir: %r", application_root_dir())

        self.setMouseTracking(True) 
開發者ID:frans-fuerst,項目名稱:track,代碼行數:19,代碼來源:mainwindow.py

示例13: init_signals

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def init_signals(self):
        # Set up signals through the event loop API.

        self.loop.add_signal_handler(signal.SIGQUIT, self.handle_quit,
                                     signal.SIGQUIT, None)

        self.loop.add_signal_handler(signal.SIGTERM, self.handle_exit,
                                     signal.SIGTERM, None)

        self.loop.add_signal_handler(signal.SIGINT, self.handle_quit,
                                     signal.SIGINT, None)

        self.loop.add_signal_handler(signal.SIGWINCH, self.handle_winch,
                                     signal.SIGWINCH, None)

        self.loop.add_signal_handler(signal.SIGUSR1, self.handle_usr1,
                                     signal.SIGUSR1, None)

        self.loop.add_signal_handler(signal.SIGABRT, self.handle_abort,
                                     signal.SIGABRT, None)

        # Don't let SIGTERM and SIGUSR1 disturb active requests
        # by interrupting system calls
        signal.siginterrupt(signal.SIGTERM, False)
        signal.siginterrupt(signal.SIGUSR1, False) 
開發者ID:skylander86,項目名稱:lambda-text-extractor,代碼行數:27,代碼來源:worker.py

示例14: init_signals

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def init_signals(self):
        # Set up signals through the event loop API.

        self.loop.add_signal_handler(
            signal.SIGQUIT, self.handle_quit, signal.SIGQUIT, None
        )

        self.loop.add_signal_handler(
            signal.SIGTERM, self.handle_exit, signal.SIGTERM, None
        )

        self.loop.add_signal_handler(
            signal.SIGINT, self.handle_quit, signal.SIGINT, None
        )

        self.loop.add_signal_handler(
            signal.SIGWINCH, self.handle_winch, signal.SIGWINCH, None
        )

        self.loop.add_signal_handler(
            signal.SIGUSR1, self.handle_usr1, signal.SIGUSR1, None
        )

        self.loop.add_signal_handler(
            signal.SIGABRT, self.handle_abort, signal.SIGABRT, None
        )

        # Don't let SIGTERM and SIGUSR1 disturb active requests
        # by interrupting system calls
        signal.siginterrupt(signal.SIGTERM, False)
        signal.siginterrupt(signal.SIGUSR1, False) 
開發者ID:huge-success,項目名稱:sanic,代碼行數:33,代碼來源:worker.py

示例15: __interceptSignals

# 需要導入模塊: import signal [as 別名]
# 或者: from signal import SIGABRT [as 別名]
def __interceptSignals(self):
        """Intercepts common signals"""
        for signum in [signal.SIGABRT,          # abnormal termination
                       signal.SIGFPE,           # floating point exception
                       signal.SIGILL,           # illegal instruction
                       signal.SIGSEGV]:         # segmentation violation
            signal.signal(signum, self.__signalHandler) 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:9,代碼來源:clientbase_cdm_dbg.py


注:本文中的signal.SIGABRT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。