fabfile.py 文件源码

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

项目:airflow-local 作者: gavinln 项目源码 文件源码
def spot_price_history(inst_type=INSTANCE_TYPE, region='us-west-2'):
    ' spot price history '
    now = datetime.datetime.utcnow()
    start_time = '{:%Y-%m-%dT%H:00:00}'.format(now)
    aws_cmd = 'aws ec2 describe-spot-price-history --start-time {} --product "Linux/UNIX" --instance-type "{}"'
    aws_cmd = aws_cmd.format(start_time, inst_type)
    jq_cmd = 'jq -c -C ".SpotPriceHistory[] | {SpotPrice, AvailabilityZone, InstanceType }"'

    with hide("running"):
        os.environ['AWS_DEFAULT_REGION'] = region
        local('|'.join([aws_cmd, jq_cmd]))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号