无法使用Boto对EMR集群进行分页

编程入门 行业动态 更新时间:2024-10-27 06:21:12
本文介绍了无法使用Boto对EMR集群进行分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我大约有55个EMR集群(它们都已终止),并且一直在尝试使用 boto 中的 list_clusters 方法检索整个55个EMR集群.我一直在寻找有关从boto分页结果集数量的示例,但找不到任何示例.鉴于此声明:

I have about 55 EMR clusters (all of them were terminated) and have been trying to retrieve the entire 55 EMR clusters using the list_clusters method in boto. I've been searching for examples about paginating the number of result set from boto but couldn't find any examples. Given this statement:

emr_object.list_clusters(cluster_states=["TERMINATED"], marker="what_should_i_use_here").clusters

我不断收到 InvalidRequestException 错误:

boto.exception.EmrResponseError: EmrResponseError: 400 Bad Request <ErrorResponse xmlns="elasticmapreduce.amazonaws/doc/2009-03-31"> <Error> <Type>Sender</Type> <Code>InvalidRequestException</Code> <Message>Marker 'what_should_i_use_here' is not valid.</Message> </Error> <RequestId>555b91bd-c122-11e3-8e31-abc75abdb39d</RequestId> </ErrorResponse>

我应该在 marker 参数中提供什么,以便我可以正确地对查询进行分页?

What should I provide in marker param so that I can properly paginate the query?

谢谢!

推荐答案

您可以在第一轮通过无"操作.

You can pass in None the first time round.

如果返回的ClusterListResult具有marker属性,则可以稍后再传递该属性,例如

If the ClusterListResult you get back has a marker attribute then you can pass that in later, e.g.

m=None while True: try: cluster_list_result=emr_object.describe_jobflows(states=['TERMINATED'], marker=m) .... Do whatever with cluster_list_result.clusters m=cluster_list_result.marker # See if there are more except AttributeError: break

更多推荐

无法使用Boto对EMR集群进行分页

本文发布于:2023-10-23 00:24:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519191.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:分页   集群   Boto   EMR

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!