本文整理汇总了Python中appscale.tools.appscale.AppScale.tail方法的典型用法代码示例。如果您正苦于以下问题:Python AppScale.tail方法的具体用法?Python AppScale.tail怎么用?Python AppScale.tail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appscale.tools.appscale.AppScale
的用法示例。
在下文中一共展示了AppScale.tail方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testTailWithIndexInBounds
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import tail [as 别名]
def testTailWithIndexInBounds(self):
# calling 'appscale tail 1 *' should tail from the second node
# (nodes[1]). If there are two nodes in this deployment,
# we should tail from it successfully
appscale = AppScale()
contents = { 'keyname' : 'boo' }
yaml_dumped_contents = yaml.dump(contents)
one = {
'public_ip' : 'blarg'
}
two = {
'public_ip' : 'blarg2'
}
nodes = {'node_info': [one, two]}
nodes_contents = json.dumps(nodes)
mock = self.addMockForAppScalefile(appscale, yaml_dumped_contents)
(mock.should_receive('open')
.with_args(appscale.get_locations_json_file('boo'))
.and_return(flexmock(read=lambda: nodes_contents)))
flexmock(subprocess)
subprocess.should_receive('call').with_args(["ssh", "-o",
"StrictHostkeyChecking=no", "-i", appscale.get_key_location('boo'),
"[email protected]", "tail -F /var/log/appscale/c*"]).and_return().once()
appscale.tail(1, "c*")
示例2: main
# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import tail [as 别名]
#.........这里部分代码省略.........
elif command == "undeploy" or command == "remove":
try:
if len(sys.argv) != 3:
cprint("Usage: appscale {0} <path to your app>".format(command), 'red')
sys.exit(1)
appscale.undeploy(sys.argv[2])
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "get":
try:
if len(sys.argv) != 3:
cprint("Usage: appscale get <regex of properties to retrieve>", 'red')
sys.exit(1)
properties = appscale.get(sys.argv[2])
for property_name, property_value in sorted(properties.iteritems()):
print "{0} -> {1}".format(property_name, property_value)
sys.exit(0)
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "set":
try:
if len(sys.argv) != 4:
cprint("Usage: appscale set <property> <value>", 'red')
sys.exit(1)
appscale.set(sys.argv[2], sys.argv[3])
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "tail":
if len(sys.argv) < 3:
# by default, tail the first node's logs, since that node is
# typically the head node
index = 0
else:
index = sys.argv[2]
if len(sys.argv) < 4:
# by default, tail the AppController logs, since that's the
# service we most often tail from
regex = "controller*"
else:
regex = sys.argv[3]
try:
appscale.tail(index, regex)
except KeyboardInterrupt:
# don't print the stack trace on a Control-C
pass
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)
elif command == "logs":
if len(sys.argv) < 3:
cprint("Usage: appscale logs <location to copy logs to>", 'red')
sys.exit(1)
try:
appscale.logs(sys.argv[2], sys.argv[3:])
except Exception as exception:
LocalState.generate_crash_log(exception, traceback.format_exc())
sys.exit(1)