MCPcopy Create free account
hub / github.com/celery/celery / Signals

Class Signals

celery/platforms.py:658–755  ·  view source on GitHub ↗

Convenience interface to :mod:`signals`. If the requested signal isn't supported on the current platform, the operation will be ignored. Example: >>> from celery.platforms import signals >>> from proj.handlers import my_handler >>> signals['INT'] = my_handler

Source from the content-addressed store, hash-verified

656
657
658class Signals:
659 """Convenience interface to :mod:`signals`.
660
661 If the requested signal isn't supported on the current platform,
662 the operation will be ignored.
663
664 Example:
665 >>> from celery.platforms import signals
666
667 >>> from proj.handlers import my_handler
668 >>> signals['INT'] = my_handler
669
670 >>> signals['INT']
671 my_handler
672
673 >>> signals.supported('INT')
674 True
675
676 >>> signals.signum('INT')
677 2
678
679 >>> signals.ignore('USR1')
680 >>> signals['USR1'] == signals.ignored
681 True
682
683 >>> signals.reset('USR1')
684 >>> signals['USR1'] == signals.default
685 True
686
687 >>> from proj.handlers import exit_handler, hup_handler
688 >>> signals.update(INT=exit_handler,
689 ... TERM=exit_handler,
690 ... HUP=hup_handler)
691 """
692
693 ignored = _signal.SIG_IGN
694 default = _signal.SIG_DFL
695
696 def arm_alarm(self, seconds):
697 return _arm_alarm(seconds)
698
699 def reset_alarm(self):
700 return _signal.alarm(0)
701
702 def supported(self, name):
703 """Return true value if signal by ``name`` exists on this platform."""
704 try:
705 self.signum(name)
706 except AttributeError:
707 return False
708 else:
709 return True
710
711 def signum(self, name):
712 """Get signal number by name."""
713 if isinstance(name, numbers.Integral):
714 return name
715 if not isinstance(name, str) \

Callers 1

platforms.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected