listStep API, Marker is not valid

0

I am using EMR API, listSteps on boto3 python library. I assigned "1" to Marker item but recevied the error message, "Marker '1' is not valid."

What value is valid at Marker?

API : https://docs.aws.amazon.com/emr/latest/APIReference/API_ListSteps.html

CS
已提問 1 年前檢視次數 244 次
1 個回答
1
已接受的答案

Hello there,

Thank you for raising this question in re:Post.

The Marker string is to facilitate pagination as the list_steps API would return only 50 steps at a time and this is helpful only when your list_steps API call for a 'ClusterId' has more than 50 steps.

Say for example if you list_steps API response had more than 50 steps, it would also have a 'Marker' element returned with list of 50 steps. A subsequent 'list_steps' API call, this time with the string you got for 'Marker' in the earlier response also passed on will fetch you the next 50 steps for the cluster. You can loop through pages until the last response is received where the response will not have the 'Marker' element.

You could use Paginators to automatically iterate through pages without having to set the 'Marker'. A sample code given below for reference, in the sample it will print all the steps details from each response one after the other.

cluster_id='j-*************'
client = boto3.client('emr', region_name='us-west-2')
paginator = client.get_paginator('list_steps')
page_iterator = paginator.paginate(ClusterId = cluster_id)
for page in page_iterator:
  print(page['Steps'])

Hope this answers your query, please feel free to reply to us if you have follow up questions. Have a great day!

AWS
支援工程師
已回答 1 年前
  • Thank you for kindly answer. I solved my problem thanks for your help. God bless you always~!

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南