当前位置: 首页>>代码示例>>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;未经允许,请勿转载。