machines_command.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:engraver 作者: onyx-platform 项目源码 文件源码
def machines_describe(arg_vars, project_root):
  cluster_id = arg_vars['cluster_id']
  path = util.machine_profiles_path(project_root, cluster_id)

  if exists(path):
    files = [f for f in listdir(path) if isfile(join(path, f))]
    t = PrettyTable(['Profile ID', 'Size', 'Services', 'Desired Count'])
    t.align = "l"
    t.align["Desired Count"] = "c"
    for f in files:
      with open(path + "/" + f, 'r') as stream:
        content = yaml.load(stream)
        t.add_row([content['profile_id'],
                   content['ec2_instance_type'],
                   ", ".join(content.get('machine_services', [])),
                   content['n_machine_instances']])
    print t
  else:
    print_fail("No machine profiles were found for this cluster.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号