当前位置: 首页>>代码示例>>Python>>正文


Python AppScale.stats方法代码示例

本文整理汇总了Python中appscale.tools.appscale.AppScale.stats方法的典型用法代码示例。如果您正苦于以下问题:Python AppScale.stats方法的具体用法?Python AppScale.stats怎么用?Python AppScale.stats使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appscale.tools.appscale.AppScale的用法示例。


在下文中一共展示了AppScale.stats方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from appscale.tools.appscale import AppScale [as 别名]
# 或者: from appscale.tools.appscale.AppScale import stats [as 别名]
def main():
  """ Execute appscale script. """
  appscale = AppScale()
  if len(sys.argv) < 2:
    print(AppScale.USAGE)
    sys.exit(1)

  command = sys.argv[1]
  if command == "init":
    if len(sys.argv) < 2:
      cprint("Usage: appscale init [cloud | cluster]", 'red')
      print("Specify 'cloud' for EC2, Eucalyptus, and Google Compute Engine " +
            "deployments, and 'cluster' if running over a virtualized cluster.")
      sys.exit(1)

    try:
      environment = sys.argv[2] if len(sys.argv) == 3 else None
      appscale.init(environment)
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)

    cprint("AppScalefile successfully created! Be sure to " +
           "customize it for your particular cloud or cluster.", 'green')
    sys.exit(0)
  elif command == "up":
    try:
      appscale.up()
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "services":
    try:
      services.main()
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "ssh":
    if len(sys.argv) < 3:
      index = None
    else:
      index = sys.argv[2]

    try:
      appscale.ssh(index)
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
    except KeyboardInterrupt:
      # don't print the stack trace on a Control-C
      pass

  elif command == "stats":
    try:
      appscale.stats(sys.argv[2:])
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)

  elif command == "status":
    try:
      appscale.status(sys.argv[2:])
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "deploy":
    try:
      if len(sys.argv) < 3 or len(sys.argv) > 5:
        cprint("Usage: appscale deploy [--project <id>] <path to your app>", 'red')
        sys.exit(1)

      if len(sys.argv) == 3:
        appscale.deploy(sys.argv[2])
      elif len(sys.argv) == 5:
        if sys.argv[2] != '--project':
          cprint("Usage: appscale deploy [--project <id>] <path to your app>", 'red')
          sys.exit(1)
        appscale.deploy(sys.argv[4], sys.argv[3])
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "create-user":
    try:
      if len(sys.argv) < 2 or len(sys.argv) > 3:
        cprint("Usage: appscale create-user [--admin]", 'red')
        sys.exit(1)
      if len(sys.argv) == 3:
        if sys.argv[2] == '--admin':
          appscale.create_user(True)
        else:
          cprint("Error: Invalid argument to 'create-user' command. To create user as admin, "
                 "you should specify the option '--admin'", 'red')
          cprint("Usage: appscale create-user --admin", 'red')
          sys.exit(1)
      elif len(sys.argv) == 2:
        appscale.create_user()
    except Exception as exception:
      LocalState.generate_crash_log(exception, traceback.format_exc())
      sys.exit(1)
  elif command == "undeploy" or command == "remove":
#.........这里部分代码省略.........
开发者ID:AppScale,项目名称:appscale-tools,代码行数:103,代码来源:appscale.py


注:本文中的appscale.tools.appscale.AppScale.stats方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。