AWSCDK,ComputeEnvironment,NotStabilized
创始人
2024-09-24 01:30:19
0

AWS CDK 是 Amazon Web Services (AWS) 的 Cloud Development Kit,允许开发人员以编程方式创建基础设施。ComputeEnvironment 是 AWS Batch 中用于执行计算工作负载的计算环境的概念。NotStabilized 表示计算环境还没有稳定,可能是因为它的资源正在被创建或更新。

要解决此问题,可以等待计算环境稳定后再继续进行其他操作。可以使用 AWS CDK 的 “waiters” 功能,等待特定 AWS Batch 计算环境状态的变化。以下是一个示例:

import * as cdk from 'aws-cdk-lib';
import { Stack } from 'aws-cdk-lib';
import * as batch from 'aws-cdk-lib/aws-batch';
import * as batch_waiter from 'aws-cdk-lib/aws-batch/lib/waiter';

class MyBatchStack extends Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const computeEnvironment = new batch.ComputeEnvironment(this, 'MyComputeEnvironment', {
      computeEnvironmentName: 'my-compute-environment',
      type: batch.ComputeEnvironmentType.MANAGED,
      computeResources: {
        instanceTypes: [ 'c5.large' ],
        maxvCpus: 64,
        desiredvCpus: 16,
        instanceRole: 'arn:aws:iam::123456789012:instance-profile/my-instance-profile',
        subnets: {
          subnetType: ec2.SubnetType.PRIVATE
        },
        securityGroups: [
          security_group
        ]
      }
    });

    const waiter = new batch_waiter.BatchComputeEnvironmentStable(this, 'BatchComputeEnvStable', {
      computeEnvironmentArn: computeEnvironment.computeEnvironmentArn
    });

    // 等待计算环境稳定
    waiter.wait({
      $waiter: {
        delay: 30, // 每隔 30 秒检查一次状态
        maxAttempts: 120 // 最大重

相关内容

热门资讯

盘点一款!微乐自建房辅助工具神... 盘点一款!微乐自建房辅助工具神器,微乐自建房脚本免费入口(开挂自建房)教程1、任何微乐自建房辅助工具...
分享实测!微乐自建房辅助工具,... 分享实测!微乐自建房辅助工具,微乐小程序免费黑科技(开挂自建房)软件1、首先打开微乐自建房辅助工具辅...
推荐一款!微乐微信自建房辅助工... 推荐一款!微乐微信自建房辅助工具插件,微乐小程序免费黑科技(开挂自建房)插件1、任何微乐微信自建房辅...
实测揭晓!微乐自建房辅助工具插... 实测揭晓!微乐自建房辅助工具插件,微乐家乡麻将自建房辅助app(开挂自建房)攻略;所有人都在同一条线...
盘点一款!微乐小程序麻将自建房... 盘点一款!微乐小程序麻将自建房辅助工具插件,微乐家乡麻将自建房辅助app(开挂自建房)教程1、微乐小...
推荐十款!微乐自建房辅助工具脚... 推荐十款!微乐自建房辅助工具脚本,微乐小程序免费黑科技(开挂自建房)教程1、微乐自建房辅助工具脚本辅...
盘点几款!微乐自建房辅助工具免... 盘点几款!微乐自建房辅助工具免费app,微乐自建房脚本免费入口(开挂自建房)app1.微乐自建房辅助...
最新技巧!微信卡五星辅助器,微... 最新技巧!微信卡五星辅助器,微乐自建房脚本免费入口(开挂自建房)方法微信卡五星辅助器透视方法中分为三...
实操分享!微乐自建房辅助工具免... 实操分享!微乐自建房辅助工具免费app,微乐小程序免费黑科技(开挂自建房)软件1、进入游戏-大厅左侧...
技术分享!微信卡五星辅助器,微... 技术分享!微信卡五星辅助器,微乐自建房脚本免费入口(开挂自建房)工具1)微信卡五星辅助器有没有挂:进...