There are more AWS SDK examples available in the AWS Doc SDK Examples
Use ListSteps with an AWS SDK or CLI
The following code examples show how to use ListSteps.
- CLI
-
- AWS CLI
-
To list the steps in a cluster
The following
list-stepsexample lists all of the steps in a cluster with the cluster IDj-3SD91U2E1L2QX.aws emr list-steps \ --cluster-idj-3SD91U2E1L2QXOutput:
{ "Steps": [ { "Id": "s-2BRWVHXA3EXBT", "Name": "Custom JAR", "Config": { "Jar": "s3://amzn-s3-demo-bucket/mytest.jar", "Properties": {}, "MainClass": "mymainclass", "Args": [ "arg1", "arg2" ] }, "ActionOnFailure": "CONTINUE", "Status": { "State": "COMPLETED", "StateChangeReason": {}, "Timeline": { "CreationDateTime": "2024-05-14T18:07:31.123000+00:00", "StartDateTime": "2024-05-14T18:10:45.456000+00:00", "EndDateTime": "2024-05-14T18:12:20.789000+00:00" } } }, { "Id": "s-1AXF2SNQKPLZR", "Name": "Setup Hadoop Debugging", "Config": { "Jar": "command-runner.jar", "Properties": {}, "Args": [ "state-pusher-script" ] }, "ActionOnFailure": "TERMINATE_CLUSTER", "Status": { "State": "COMPLETED", "StateChangeReason": {}, "Timeline": { "CreationDateTime": "2024-05-14T18:01:02.345000+00:00", "StartDateTime": "2024-05-14T18:09:30.678000+00:00", "EndDateTime": "2024-05-14T18:10:40.901000+00:00" } } } ] }For more information, see Submit work to an Amazon EMR cluster in the Amazon EMR Management Guide.
-
For API details, see ListSteps
in AWS CLI Command Reference.
-
- Python
-
- SDK for Python (Boto3)
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. def list_steps(cluster_id, emr_client): """ Gets a list of steps for the specified cluster. In this example, all steps are returned, including completed and failed steps. :param cluster_id: The ID of the cluster. :param emr_client: The Boto3 EMR client object. :return: The list of steps for the specified cluster. """ try: response = emr_client.list_steps(ClusterId=cluster_id) steps = response["Steps"] logger.info("Got %s steps for cluster %s.", len(steps), cluster_id) except ClientError: logger.exception("Couldn't get steps for cluster %s.", cluster_id) raise else: return steps-
For API details, see ListSteps in AWS SDK for Python (Boto3) API Reference.
-
- SAP ABAP
-
- SDK for SAP ABAP
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. TRY. oo_result = lo_emr->liststeps( iv_clusterid = iv_cluster_id ). DATA(lt_steps) = oo_result->get_steps( ). DATA(lv_step_count) = lines( lt_steps ). MESSAGE |Retrieved { lv_step_count } steps for cluster| TYPE 'I'. CATCH /aws1/cx_emrinternalserverex INTO DATA(lo_internal_error). DATA(lv_error) = lo_internal_error->if_message~get_text( ). MESSAGE lv_error TYPE 'E'. CATCH /aws1/cx_emrinvalidrequestex INTO DATA(lo_invalid_error). lv_error = lo_invalid_error->if_message~get_text( ). MESSAGE lv_error TYPE 'E'. ENDTRY.-
For API details, see ListSteps in AWS SDK for SAP ABAP API reference.
-