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


Python AppControllerClient.get_status方法代码示例

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


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

示例1: ensure_appscale_isnt_running

# 需要导入模块: from appcontroller_client import AppControllerClient [as 别名]
# 或者: from appcontroller_client.AppControllerClient import get_status [as 别名]
  def ensure_appscale_isnt_running(cls, keyname, force):
    """Checks the secret key file to see if AppScale is running, and
    aborts if it is.

    Args:
      keyname: The keypair name that is used to identify AppScale deployments.
      force: A bool that is used to run AppScale even if the secret key file
        is present.
    Raises:
      BadConfigurationException: If AppScale is already running.
    """
    if force:
      return

    if os.path.exists(cls.get_secret_key_location(keyname)):
      try:
        login_host = cls.get_login_host(keyname)
        secret_key = cls.get_secret_key(keyname)
      except (IOError, AppScaleException, BadConfigurationException):
        # If we don't have the locations files, we are not running.
        return

      acc = AppControllerClient(login_host, secret_key)
      try:
        acc.get_status()
      except AppControllerException:
        # AC is not running, so we assume appscale is not up and running.
        AppScaleLogger.log("AppController not running on login node.")
      else:
        raise BadConfigurationException("AppScale is already running. Terminate" +
          " it, set 'force: True' in your AppScalefile, or use the --force flag" +
          " to run anyways.")
开发者ID:menivaitsi,项目名称:appscale-tools,代码行数:34,代码来源:local_state.py

示例2: describe_instances

# 需要导入模块: from appcontroller_client import AppControllerClient [as 别名]
# 或者: from appcontroller_client.AppControllerClient import get_status [as 别名]
  def describe_instances(cls, options):
    """Queries each node in the currently running AppScale deployment and
    reports on their status.

    Args:
      options: A Namespace that has fields for each parameter that can be
        passed in via the command-line interface.
    """
    login_host = LocalState.get_login_host(options.keyname)
    login_acc = AppControllerClient(login_host,
      LocalState.get_secret_key(options.keyname))

    for ip in login_acc.get_all_public_ips():
      acc = AppControllerClient(ip, LocalState.get_secret_key(options.keyname))
      AppScaleLogger.log("Status of node at {0}:".format(ip))
      try:
        AppScaleLogger.log(acc.get_status())
      except Exception as e:
        AppScaleLogger.warn("Unable to contact machine: {0}\n".format(str(e)))

    AppScaleLogger.success("View status information about your AppScale " + \
      "deployment at http://{0}/status".format(login_host))
开发者ID:DrOctogon,项目名称:appscale-tools,代码行数:24,代码来源:appscale_tools.py


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