在使用Boto3创建EMR集群时遇到了一些问题。我得到的错误如下:
botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the RunJobFlow operation: Attempted to set bid price for on demand instance group.我将此配置指定如下:
'Name': 'Core - 2',
'InstanceRole': 'CORE',
'InstanceType': 'i3.2xlarge',
'InstanceCount': 50,
'BidPrice': 'OnDemandPrice',Boto3 API似乎不允许这样做,我也不想使用AWS。是否有办法通过Boto3指定spot实例?
发布于 2021-09-15 23:05:00
关于这一点,在boto3回购中还有一个悬而未决的问题。目前,如果您指定"Market": "SPOT",BidPriceAsPercentageOfOnDemandPrice将默认为100%,也就是按需价格。
下面是一个使用boto3==1.18.42的示例。
import boto3
client = boto3.client("emr", region_name="us-east-1")
response = client.run_job_flow(
Name="Boto3 test cluster",
ReleaseLabel="emr-5.33.0",
Instances={
"KeepJobFlowAliveWhenNoSteps": True,
"TerminationProtected": False,
"InstanceGroups": [
{
"InstanceRole": "MASTER",
"InstanceCount": 1,
"InstanceType": "i3.2xlarge",
"Name": "Master",
},
{
"InstanceRole": "CORE",
"InstanceCount": 2,
"InstanceType": "i3.2xlarge",
"Name": "Core",
"Market": "SPOT",
},
],
},
VisibleToAllUsers=True,
JobFlowRole="EMR_EC2_DefaultRole",
ServiceRole="EMR_DefaultRole",
)https://stackoverflow.com/questions/69186734
复制相似问题