本文整理汇总了Python中voltcli.utility.error函数的典型用法代码示例。如果您正苦于以下问题:Python error函数的具体用法?Python error怎么用?Python error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了error函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: abort
def abort(self, *msgs):
"""
Display errors (optional) and abort execution.
"""
utility.error('Fatal error in "%s" command.' % self.verb.name, *msgs)
self.help()
utility.abort()
开发者ID:sumitk1,项目名称:voltdb,代码行数:7,代码来源:runner.py
示例2: help
def help(self, *args, **kwargs):
"""
Display help for command.
"""
# The only valid keyword argument is 'all' for now.
context = '%s.help()' % self.__class__.__name__
all = utility.kwargs_get_boolean(kwargs, 'all', default = False)
if all:
for verb_name in self.verbspace.verb_names:
verb_spec = self.verbspace.verbs[verb_name].cli_spec
if not verb_spec.baseverb and not verb_spec.hideverb:
sys.stdout.write('\n===== Verb: %s =====\n\n' % verb_name)
self._print_verb_help(verb_name)
for verb_name in self.verbspace.verb_names:
verb_spec = self.verbspace.verbs[verb_name].cli_spec
if verb_spec.baseverb and not verb_spec.hideverb:
sys.stdout.write('\n===== Common Verb: %s =====\n\n' % verb_name)
self._print_verb_help(verb_name)
else:
if args:
for name in args:
for verb_name in self.verbspace.verb_names:
if verb_name == name.lower():
sys.stdout.write('\n')
self._print_verb_help(verb_name)
break
else:
utility.error('Verb "%s" was not found.' % name)
self.usage()
else:
self.usage()
开发者ID:bear000s,项目名称:voltdb,代码行数:31,代码来源:runner.py
示例3: pause
def pause(runner):
# Check the STATUS column. runner.call_proc() detects and aborts on errors.
status = runner.call_proc('@Pause', [], []).table(0).tuple(0).column_integer(0)
if status == 0:
utility.info('The cluster is paused.')
else:
utility.error('The cluster has failed to pause with status: %d' % status)
开发者ID:sumitk1,项目名称:voltdb,代码行数:7,代码来源:pause.py
示例4: _abort
def _abort(self, show_help, *msgs):
if self.verb:
utility.error('Fatal error in "%s" command.' % self.verb.name, *msgs)
if show_help:
self.verb_usage()
else:
utility.error(*msgs)
if show_help:
self.help()
sys.exit(1)
开发者ID:bear000s,项目名称:voltdb,代码行数:10,代码来源:runner.py
示例5: go
def go(self, runner):
mod_name = runner.opts.modifier.lower()
for mod in self.modifiers:
if mod.name == mod_name:
mod.function(runner)
break
else:
utility.error('Invalid "%s" modifier "%s". Valid modifiers are listed below:'
% (self.name, mod_name),
[mod.name for mod in self.modifiers])
runner.help(self.name)
开发者ID:AsherBond,项目名称:voltdb,代码行数:11,代码来源:verbs.py
示例6: error
def error(self, *msgs):
"""
Display ERROR level messages.
"""
utility.error(*msgs)
开发者ID:bear000s,项目名称:voltdb,代码行数:5,代码来源:runner.py
示例7: _abort
def _abort(self, *msgs):
utility.error(*msgs)
sys.stdout.write('\n')
self.print_help()
sys.stdout.write('\n')
sys.exit(1)
开发者ID:TeaTips,项目名称:voltdb,代码行数:6,代码来源:cli.py
示例8: get
else:
# All other arguments are treated as scalars.
# Pass through argument class get() for validation, conversion, etc..
try:
value = arg.get(args[iarg])
except ArgumentException, e:
exceptions.append(e)
iarg += 1
if value is not None:
setattr(verb_opts, arg.name, value)
# Run the gauntlet of error disclosure. Abort and display usage as appropriate.
had_errors = 0
show_usage = False
if exceptions:
msg = 'Argument value %s:' % utility.pluralize('error', len(exceptions))
utility.error(msg, [e.message for e in exceptions])
had_errors += 1
if iarg < len(args):
self._abort('Extra arguments were provided:', args[iarg:])
had_errors += 1
show_usage = True
if missing:
fmt = '%%-%ds %%s' % max([len(o) for (o, h) in missing])
msg = 'Missing required %s:' % utility.pluralize('argument', len(missing))
utility.error(msg, [fmt % (o.upper(), h) for (o, h) in missing])
had_errors += 1
show_usage = True
if had_errors > 0:
if show_usage:
self._abort()
sys.exit(1)
开发者ID:TeaTips,项目名称:voltdb,代码行数:31,代码来源:cli.py
示例9: go
def go(self, verb, runner):
if self.check_environment_config:
incompatible_options = checkconfig.test_hard_requirements()
for k,v in incompatible_options.items():
state = v[0]
if state == 'PASS' :
pass
elif state == "WARN":
utility.warning(v[1])
elif state == 'FAIL' :
if k in checkconfig.skippableRequirements.keys() and runner.opts.skip_requirements and checkconfig.skippableRequirements[k] in runner.opts.skip_requirements:
utility.warning(v[1])
else:
utility.abort(v[1])
else:
utility.error(v[1])
final_args = None
if self.subcommand in ('create', 'recover'):
if runner.opts.replica:
final_args = [self.subcommand, 'replica']
if self.supports_live:
if runner.opts.block:
final_args = [self.subcommand]
else:
final_args = ['live', self.subcommand]
elif final_args == None:
final_args = [self.subcommand]
if self.safemode_available:
if runner.opts.safemode:
final_args.extend(['safemode'])
if self.needs_catalog:
catalog = runner.opts.catalog
if not catalog:
catalog = runner.config.get('volt.catalog')
if not catalog is None:
final_args.extend(['catalog', catalog])
if runner.opts.deployment:
final_args.extend(['deployment', runner.opts.deployment])
if runner.opts.placementgroup:
final_args.extend(['placementgroup', runner.opts.placementgroup])
if runner.opts.host:
final_args.extend(['host', runner.opts.host])
else:
utility.abort('host is required.')
if runner.opts.clientport:
final_args.extend(['port', runner.opts.clientport])
if runner.opts.adminport:
final_args.extend(['adminport', runner.opts.adminport])
if runner.opts.httpport:
final_args.extend(['httpport', runner.opts.httpport])
if runner.opts.license:
final_args.extend(['license', runner.opts.license])
if runner.opts.internalinterface:
final_args.extend(['internalinterface', runner.opts.internalinterface])
if runner.opts.internalport:
final_args.extend(['internalport', runner.opts.internalport])
if runner.opts.replicationport:
final_args.extend(['replicationport', runner.opts.replicationport])
if runner.opts.zkport:
final_args.extend(['zkport', runner.opts.zkport])
if runner.opts.externalinterface:
final_args.extend(['externalinterface', runner.opts.externalinterface])
if runner.opts.publicinterface:
final_args.extend(['publicinterface', runner.opts.publicinterface])
if self.subcommand in ('create'):
if runner.opts.new:
final_args.extend(['new'])
if runner.args:
final_args.extend(runner.args)
kwargs = {}
if self.supports_daemon and runner.opts.daemon:
# Provide a default description if not specified.
daemon_description = self.daemon_description
if daemon_description is None:
daemon_description = "VoltDB server"
# Initialize all the daemon-related keyword arguments.
runner.setup_daemon_kwargs(kwargs, name=self.daemon_name,
description=daemon_description,
output=self.daemon_output)
else:
# Replace the Python process.
kwargs['exec'] = True
self.run_java(verb, runner, *final_args, **kwargs)
开发者ID:cc13ny,项目名称:voltdb,代码行数:85,代码来源:verbs.py
示例10: len
elif len(args) > 0:
# All other arguments are treated as scalars.
# Pass through argument class get() for validation, conversion, etc..
try:
value = arg.get(args[iarg])
except ArgumentException, e:
exceptions.append(e)
iarg += 1
if value is not None or arg.min_count == 0:
setattr(verb_opts, arg.name, value)
# Run the gauntlet of error disclosure. Abort and display usage as appropriate.
had_errors = 0
show_usage = False
if exceptions:
msg = 'Argument value %s:' % utility.pluralize('error', len(exceptions))
utility.error(msg, [str(e) for e in exceptions])
had_errors += 1
if iarg < len(args):
self._abort('Extra arguments were provided:', args[iarg:])
had_errors += 1
show_usage = True
if missing:
fmt = '%%-%ds %%s' % max([len(o) for (o, h) in missing])
msg = 'Missing required %s:' % utility.pluralize('argument', len(missing))
utility.error(msg, [fmt % (o.upper(), h) for (o, h) in missing])
had_errors += 1
show_usage = True
if had_errors > 0:
if show_usage:
self._abort()
sys.exit(1)
开发者ID:migue,项目名称:voltdb,代码行数:31,代码来源:cli.py
示例11: go
def go(self, verb, runner):
if self.check_environment_config:
incompatible_options = checkconfig.test_hard_requirements()
for k, v in incompatible_options.items():
state = v[0]
if state == "PASS":
pass
elif state == "WARN":
utility.warning(v[1])
elif state == "FAIL":
if (
k in checkconfig.skippableRequirements.keys()
and runner.opts.skip_requirements
and checkconfig.skippableRequirements[k] in runner.opts.skip_requirements
):
utility.warning(v[1])
else:
utility.abort(v[1])
else:
utility.error(v[1])
final_args = None
if self.subcommand in ("create", "recover"):
if runner.opts.replica:
final_args = [self.subcommand, "replica"]
if self.supports_live:
if runner.opts.block:
final_args = [self.subcommand]
else:
final_args = ["live", self.subcommand]
elif final_args == None:
final_args = [self.subcommand]
if self.safemode_available:
if runner.opts.safemode:
final_args.extend(["safemode"])
if self.needs_catalog:
catalog = runner.opts.catalog
if not catalog:
catalog = runner.config.get("volt.catalog")
if not catalog is None:
final_args.extend(["catalog", catalog])
if runner.opts.deployment:
final_args.extend(["deployment", runner.opts.deployment])
if runner.opts.placementgroup:
final_args.extend(["placementgroup", runner.opts.placementgroup])
if runner.opts.host:
final_args.extend(["host", runner.opts.host])
else:
utility.abort("host is required.")
if runner.opts.clientport:
final_args.extend(["port", runner.opts.clientport])
if runner.opts.adminport:
final_args.extend(["adminport", runner.opts.adminport])
if runner.opts.httpport:
final_args.extend(["httpport", runner.opts.httpport])
if runner.opts.license:
final_args.extend(["license", runner.opts.license])
if runner.opts.internalinterface:
final_args.extend(["internalinterface", runner.opts.internalinterface])
if runner.opts.internalport:
final_args.extend(["internalport", runner.opts.internalport])
if runner.opts.replicationport:
final_args.extend(["replicationport", runner.opts.replicationport])
if runner.opts.zkport:
final_args.extend(["zkport", runner.opts.zkport])
if runner.opts.externalinterface:
final_args.extend(["externalinterface", runner.opts.externalinterface])
if runner.opts.publicinterface:
final_args.extend(["publicinterface", runner.opts.publicinterface])
if runner.args:
final_args.extend(runner.args)
kwargs = {}
if self.supports_daemon and runner.opts.daemon:
# Provide a default description if not specified.
daemon_description = self.daemon_description
if daemon_description is None:
daemon_description = "VoltDB server"
# Initialize all the daemon-related keyword arguments.
runner.setup_daemon_kwargs(
kwargs, name=self.daemon_name, description=daemon_description, output=self.daemon_output
)
else:
# Replace the Python process.
kwargs["exec"] = True
self.run_java(verb, runner, *final_args, **kwargs)
开发者ID:royxhl,项目名称:voltdb,代码行数:86,代码来源:verbs.py
注:本文中的voltcli.utility.error函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论