options.executor.executeAction('tracing:store', **{ 'configuration_service': options.getService('unicorn'), 'name': name, 'value': value, }) @tracingDispatcher.command(name='remove', usage='-n NAME') def tracing_remove(options, name=('n', '', 'node name')): options.executor.executeAction('tracing:remove', **{ 'configuration_service': options.getService('unicorn'), 'name': name, }) @tracingDispatcher.command(name='view', usage='-n NAME') def tracing_view(options, name=('n', '', 'node name')): options.executor.executeAction('tracing:view', **{ 'configuration_service': options.getService('unicorn'), 'name': name, }) d.nest('app', appDispatcher, 'application commands') d.nest('profile', profileDispatcher, 'profile commands') d.nest('runlist', runlistDispatcher, 'runlist commands') d.nest('crashlog', crashlogDispatcher, 'crashlog commands') d.nest('group', dispatcher.group, 'routing group commands') d.nest('tracing', tracingDispatcher, 'tracing configuration commands')
def subcmd1(quiet=('q', False, 'quietly'), showhelp=('h', False, 'Print the help message')): '''Help for subcmd1''' if not quiet: print('running subcmd1') if showhelp: print('Showing the help:') subcmd1.help() @d2.command() def subcmd2(number): '''Help for subcmd2''' print('running subcmd2', number) d3 = Dispatcher() @d3.command() def subsubcmd(loud=('l', False, 'loudly'), showhelp=('h', False, 'Print the help message')): '''Help for subsubcmd''' if loud: print('running subsubcmd') if showhelp: print('Showing the help:') subsubcmd.help() d2.nest('subcmd3', d3, 'Help for subcmd3') d.nest('cmd', d2, 'Help for cmd') if __name__ == '__main__': d.dispatch()
"""Stop embedded cocaine proxy. """ Global.configureLog(logNames=['cocaine.tools', 'cocaine.proxy']) try: proxy.Stop(**{ 'pidfile': pidfile, }).execute() except proxy.Error as err: logging.getLogger('cocaine.tools').error('Cocaine tool error - %s', err) @proxyDispatcher.command() def status(pidfile=('', DEFAULT_COCAINE_PROXY_PID_FILE, 'pidfile')): """Show embedded cocaine proxy status. """ Global.configureLog(logNames=['cocaine.tools', 'cocaine.proxy']) try: proxy.Status(**{ 'pidfile': pidfile, }).execute() except proxy.Error as err: logging.getLogger('cocaine.tools').error('Cocaine tool error - %s', err) d.nest('app', appDispatcher, 'application commands') d.nest('profile', profileDispatcher, 'profile commands') d.nest('runlist', runlistDispatcher, 'runlist commands') d.nest('crashlog', crashlogDispatcher, 'crashlog commands') d.nest('group', dispatcher.group, 'routing group commands') d.nest('proxy', proxyDispatcher, 'cocaine proxy commands')
@proxyDispatcher.command() def stop(pidfile=("", DEFAULT_COCAINE_PROXY_PID_FILE, "pidfile")): """Stop embedded cocaine proxy. """ Global.configureLog(logNames=["cocaine.tools", "cocaine.proxy"]) try: proxy.Stop(**{"pidfile": pidfile}).execute() except proxy.Error as err: logging.getLogger("cocaine.tools").error("Cocaine tool error - %s", err) @proxyDispatcher.command() def status(pidfile=("", DEFAULT_COCAINE_PROXY_PID_FILE, "pidfile")): """Show embedded cocaine proxy status. """ Global.configureLog(logNames=["cocaine.tools", "cocaine.proxy"]) try: proxy.Status(**{"pidfile": pidfile}).execute() except proxy.Error as err: logging.getLogger("cocaine.tools").error("Cocaine tool error - %s", err) d.nest("app", appDispatcher, "application commands") d.nest("profile", profileDispatcher, "profile commands") d.nest("runlist", runlistDispatcher, "runlist commands") d.nest("crashlog", crashlogDispatcher, "crashlog commands") d.nest("group", dispatcher.group, "routing group commands") d.nest("proxy", proxyDispatcher, "cocaine proxy commands")
""" Global.configureLog(logNames=['cocaine.tools', 'cocaine.proxy']) try: proxy.Stop(**{ 'pidfile': pidfile, }).execute() except proxy.Error as err: logging.getLogger('cocaine.tools').error('Cocaine tool error - %s', err) @proxyDispatcher.command() def status(pidfile=('', DEFAULT_COCAINE_PROXY_PID_FILE, 'pidfile')): """Show embedded cocaine proxy status. """ Global.configureLog(logNames=['cocaine.tools', 'cocaine.proxy']) try: proxy.Status(**{ 'pidfile': pidfile, }).execute() except proxy.Error as err: logging.getLogger('cocaine.tools').error('Cocaine tool error - %s', err) d.nest('app', appDispatcher, 'application commands') d.nest('profile', profileDispatcher, 'profile commands') d.nest('runlist', runlistDispatcher, 'runlist commands') d.nest('crashlog', crashlogDispatcher, 'crashlog commands') d.nest('group', dispatcher.group, 'routing group commands') d.nest('proxy', proxyDispatcher, 'cocaine proxy commands')
def subcmd2(number): '''Help for subcmd2''' print('running subcmd2', number) d3 = Dispatcher() @d3.command() def subsubcmd(loud=('l', False, 'loudly'), showhelp=('h', False, 'Print the help message')): '''Help for subsubcmd''' if loud: print('running subsubcmd') if showhelp: print('Showing the help:') subsubcmd.help() d2.nest('subcmd3', d3, 'Help for subcmd3') d.nest('cmd', d2, 'Help for cmd') if __name__ == '__main__': d.dispatch() ########NEW FILE######## __FILENAME__ = test_extopts # First line of opttypes.py from __future__ import print_function import sys from decimal import Decimal from fractions import Fraction from opster import command
'configuration_service': options.getService('unicorn'), 'name': name, 'value': value, }) @tracingDispatcher.command(name='remove', usage='-n NAME') def tracing_remove(options, name=('n', '', 'node name')): options.executor.executeAction( 'tracing:remove', **{ 'configuration_service': options.getService('unicorn'), 'name': name, }) @tracingDispatcher.command(name='view', usage='-n NAME') def tracing_view(options, name=('n', '', 'node name')): options.executor.executeAction( 'tracing:view', **{ 'configuration_service': options.getService('unicorn'), 'name': name, }) d.nest('app', appDispatcher, 'application commands') d.nest('profile', profileDispatcher, 'profile commands') d.nest('runlist', runlistDispatcher, 'runlist commands') d.nest('crashlog', crashlogDispatcher, 'crashlog commands') d.nest('group', dispatcher.group, 'routing group commands') d.nest('tracing', tracingDispatcher, 'tracing configuration commands')