Python 列出所有步骤信息BOTO

Python 列出所有步骤信息BOTO,python,json,amazon-web-services,boto,Python,Json,Amazon Web Services,Boto,我想知道是否有一种方法可以通过boto列出emr集群上的所有信息。我知道aws cli可以通过aws emr列表步骤--cluster id来实现这一点 这将提供此群集中所有步骤的所有信息;我想使用python和boto做同样的事情,但想知道boto emr中是否有一个选项,您可以列出所有信息(如aws cli打印)…目前,我必须通过特定调用获取每个信息,例如: >>> conn.list_steps('j-2J699C85LW1R6').steps [<

我想知道是否有一种方法可以通过boto列出emr集群上的所有信息。我知道aws cli可以通过
aws emr列表步骤--cluster id
来实现这一点

这将提供此群集中所有步骤的所有信息;我想使用python和boto做同样的事情,但想知道boto emr中是否有一个选项,您可以列出所有信息(如aws cli打印)…目前,我必须通过特定调用获取每个信息,例如:

    >>> conn.list_steps('j-2J699C85LW1R6').steps
    [<boto.emr.emrobject.StepSummary object at 0x107785ad0>,
     <boto.emr.emrobject.StepSummary object at 0x107798b90>,
     <boto.emr.emrobject.StepSummary object at 0x107798d90>,
     <boto.emr.emrobject.StepSummary object at 0x10778e650>,
     <boto.emr.emrobject.StepSummary object at 0x10778ea90>,]
    >>> conn.list_steps('j-2J699C85LW1R6').steps[0].id
    u's-2LLDFU54O55DJ'
    >>> conn.list_steps('j-2J699C85LW1R6').steps[0].status.state
    u'COMPLETED'
连接列表步骤('j-2J699C85LW1R6')。步骤 [, , , , ,] >>>conn.list_步骤('j-2J699C85LW1R6')。步骤[0]。id u's-2LLDFU54O55DJ' >>>conn.list_步骤('j-2J699C85LW1R6')。步骤[0]。状态。状态 “完成”
有很多类似这样的小参数,比如
timeline.enddatetime、config.args、actionfailure等
,我想知道是否有一个简单的命令可以在一次调用中检索所有这些信息以返回json或类似的东西。

您可以使用description\u-step方法来获取其他详细信息


您可以使用descripe_step方法获取其他详细信息


没有单独的调用,但是您可以得到一个步骤列表,然后遍历它们,在每个步骤上调用descripe\u步骤。下面是我的完整示例中的两个函数


没有单独的调用,但是您可以得到一个步骤列表,然后遍历它们,在每个步骤上调用descripe\u步骤。下面是我的完整示例中的两个函数

describe_step(cluster_id, step_id)
Describe an Elastic MapReduce step

Parameters: 
cluster_id (str) – The cluster id of interest
step_id (str) – The step id of interest
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


def describe_step(cluster_id, step_id, emr_client):
    """
    Gets detailed information about the specified step, including the current state of
    the step.
    :param cluster_id: The ID of the cluster.
    :param step_id: The ID of the step.
    :param emr_client: The Boto3 EMR client object.
    :return: The retrieved information about the specified step.
    """
    try:
        response = emr_client.describe_step(ClusterId=cluster_id, StepId=step_id)
        step = response['Step']
        logger.info("Got data for step %s.", step_id)
    except ClientError:
        logger.exception("Couldn't get data for step %s.", step_id)
        raise
    else:
        return step