Hi Alan and Victor, Thank you very much for your suggestions and patch!
But, I am just one of the contributers for Ryu. Then, would you review my attached patch? If this patch looks good, this might be adopted through Ryu-devel. FYI, with this patch, ryu-manager will outputs messages as follows when killed by keyboard. e.g.) $ ryu-manager --verbose loading app ryu.controller.ofp_handler instantiating app ryu.controller.ofp_handler of OFPHandler BRICK ofp_event CONSUMES EventOFPSwitchFeatures CONSUMES EventOFPHello CONSUMES EventOFPEchoReply CONSUMES EventOFPEchoRequest CONSUMES EventOFPPortDescStatsReply CONSUMES EventOFPErrorMsg CONSUMES EventOFPPortStatus ^CKeyboard Interrupt received. Closing RYU application manager... $ Thanks, Iwase On 2016年07月20日 22:24, [email protected] wrote:
Hi Iwase, Taking on board Victor's comments I made the following changes to my manager.py file... LOG = logging.getLogger('ryu.cmd.manager') if CONF.enable_debugger: msg = 'debugging is available (--enable-debugger option is turned on)' LOG.info(msg) else: hub.patch(thread=True) ... try: hub.joinall(services) except KeyboardInterrupt: LOG.debug("Keyboard Interrupt received - RYU application manager closing") finally: app_mgr.close() Is this something you would consider including in the next RYU release? Thanks again, Alan. -----Original Message----- From: [email protected] [mailto:[email protected]] Sent: Wednesday, July 20, 2016 11:39 AM To: [email protected] Cc: [email protected] Subject: Re: [Ryu-devel] KeyboardInterrupt (ctrl-c) and RYU Your suggestion of a log message is probably the best approach. Thanks, Alan. -----Original Message----- From: Victor Orlikowski [mailto:[email protected]] Sent: Wednesday, July 20, 2016 11:36 AM To: FORDYCE,ALAN (K-Scotland,ex1) <[email protected]> Cc: [email protected] Subject: Re: [Ryu-devel] KeyboardInterrupt (ctrl-c) and RYU Also - should be obvious - but include a comment on the pass, explaining that you're "papering over" the fact that eventlet doesn't properly wrap the KeyboardInterrupt inside select()/poll()/epoll(). Another suggestion: instead of a pass, a log message, at debug level (or whatever desired default priority), that notes that Ctrl-C was received and applications are terminating. Best, Victor -- Victor J. Orlikowski <> vjo@[cs.]duke.eduOn Jul 20, 2016, at 11:20 AM, Victor Orlikowski <[email protected]> wrote: Suggest just silently swallowing the KeyboardInterrupt (with a "pass"), since the finally block will cover the close().------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel ------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
>From c083f7484d6283317845b616f57b4ac62ea55509 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke <[email protected]> Date: Thu, 21 Jul 2016 10:22:34 +0900 Subject: [PATCH] manager: Except KeyboardInterrupt to suppress traceback Currently, ryu-manager displays tracback messages when killed by the keyboard interrupt. This patch enables to catch KeyboardInterrupt exceptions and suppress these messages to close down cleanly. Signed-off-by: Victor J. Orlikowski <[email protected]> Signed-off-by: Alan Fordyce <[email protected]> Signed-off-by: IWASE Yusuke <[email protected]> --- ryu/cmd/manager.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py index b1ce8da..1e1a6b4 100755 --- a/ryu/cmd/manager.py +++ b/ryu/cmd/manager.py @@ -66,11 +66,11 @@ def main(args=None, prog=None): project='ryu', version='ryu-manager %s' % version) log.init_log() + logger = logging.getLogger(__name__) if CONF.enable_debugger: - LOG = logging.getLogger('ryu.cmd.manager') msg = 'debugging is available (--enable-debugger option is turned on)' - LOG.info(msg) + logger.info(msg) else: hub.patch(thread=True) @@ -80,7 +80,7 @@ def main(args=None, prog=None): pid_file.write(str(os.getpid())) app_lists = CONF.app_lists + CONF.app - # keep old behaivor, run ofp if no application is specified. + # keep old behavior, run ofp if no application is specified. if not app_lists: app_lists = ['ryu.controller.ofp_handler'] @@ -97,6 +97,9 @@ def main(args=None, prog=None): try: hub.joinall(services) + except KeyboardInterrupt: + logger.debug("Keyboard Interrupt received. " + "Closing RYU application manager...") finally: app_mgr.close() -- 2.7.4
------------------------------------------------------------------------------ What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic patterns at an interface-level. Reveals which users, apps, and protocols are consuming the most bandwidth. Provides multi-vendor support for NetFlow, J-Flow, sFlow and other flows. Make informed decisions using capacity planning reports.http://sdm.link/zohodev2dev
_______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
