Best Python code snippet using pyatom_python
libdaemon.py
Source:libdaemon.py
...98 try:99 os.unlink( self.pidfile )100 except Exception:101 pass102 def _sigHandler( self, sig, frame ):103 logging.debug( 'libdaemon: Got Signal %d', sig )104 if sig in ( signal.SIGINT, signal.SIGQUIT, signal.SIGTERM ):105 logging.info( 'libdaemon: Got Stop Signal' )106 self.need_restart = False107 self.do_stop()108 elif sig == signal.SIGHUP:109 logging.info( 'libdaemon: Got Restart Signal' )110 self.need_restart = True111 self.do_stop()112 elif sig == signal.SIGSYS:113 logging.info( 'libdaemon: Got Reload Config Signal' )114 if not self.do_loadconfig():115 self.need_restart = False116 self.do_stop()...
nullunitIterate
Source:nullunitIterate
...11from nullunit.iterate import readState, writeState, doStep12from nullunit.procutils import open_output, close_output, execute13PID_FILE = '/var/run/nullunitIterate.pid'14STATE_FILE = '/var/lib/mcp/nullunitIterate.state'15def _sigHandler( sig, frame ):16 global cont17 logging.debug( 'Got Signal {0}, stopping...'.format( sig ) )18 cont = False19oparser = OptionParser( description='nullunit iterator' )20oparser.add_option( '-v', '--verbose', dest='verbose', default=False, action='store_true' )21oparser.add_option( '-s', '--step', dest='step', default=False, action='store_true' )22( options, args ) = oparser.parse_args()23logging.basicConfig()24logger = logging.getLogger()25handler = SysLogHandler( address='/dev/log', facility=SysLogHandler.LOG_DAEMON )26handler.setFormatter( logging.Formatter( fmt='nullunitIterate [%(process)d]: %(message)s' ) )27logger.addHandler( handler )28if options.verbose:29 logger.setLevel( logging.DEBUG )...
attachment-0004.py
Source:attachment-0004.py
...38 39 if hasattr(signal, "SIGBREAK"):40 signal.signal(signal.SIGBREAK, self._sigHandler)41 42 def _sigHandler(self, signum, frame):43 print "Received %d signal" % signum44 if(signum == signal.SIGINT or signum == signal.SIGTERM):45 print "toto"46 reactor.callLater(0, reactor.stop)47# reactor.callFromThread(reactor.stop)48# reactor.stop()49# import sys50# sys.exit(0)51 52 # Catch Ctrl-Break in windows53 elif(hasattr(signal, "SIGBREAK") and signum == signal.SIGBREAK):54 print "titi"55 reactor.callLater(0, reactor.stop)56# reactor.callFromThread(reactor.stop)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!