AWS EMR中的Step Types指的是在启动Cluster之后,运行Job Flow时所需要的各类Step类型。Step Types通常包括Hadoop, Spark等分布式计算框架的Step类型。AWS EMR支持多种Step Types,下面就是一些常用的Step Types及对应的用法和示例代码。
代码示例:
from aws_cdk import ( aws_emr as emr, core, )
class EmrStack(core.Stack): def init(self, scope: core.Construct, id: str, **kwargs) -> None: self.emr_cluster = emr.CfnCluster( self, id='emr-cluster', name='emr-cluster', release_label='emr-5.32.0', instances=emr.CfnCluster.JobFlowInstancesConfigProperty( core_count=2, master_instance_fleet=emr.CfnCluster.InstanceFleetConfigProperty( target_on_demand_capacity=1, instance_type_configs=[ emr.CfnCluster.InstanceTypeConfigProperty(instance_type='m6g.xlarge'), ], ), core_instance_fleet=emr.CfnCluster.InstanceFleetConfigProperty( target_spot_capacity=1, instance_type_configs=[ emr.CfnCluster.InstanceTypeConfigProperty(instance_type='m6g.xlarge'), ], ), ), applications=[emr.CfnCluster.ApplicationProperty(name='Hadoop')], steps=[ emr.CfnStep( name='Word Count', action_on_failure='CONTINUE', hadoop_jar_step=emr.CfnStep.HadoopJarStepConfigProperty( jar='command-runner.jar', args=[ 'hadoop', 'jar', '/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar', 'wordcount', 's3://my-bucket/my-input-path', 's3://my-bucket/my-output-path', ], ) ) ], )
代码示例:
from aws_cdk import ( aws_emr as emr, core, )
class EmrStack(core.Stack): def init(self, scope: core.Construct, id: str, **kwargs) -> None: self.emr_cluster