Search code examples
botoemramazon-emr

EMR/boto - How to get cluster id and step id using boto?


There are some describe_* functions in boto.emr need step_id. But the document does not describe very clearly how to obtain the step_id after submitting steps.

How can I get these step_ids after run_jobflow or add_steps?


Solution

  • The job-id (cluster id) can be found on the boto.emr.emrobject.JobFlow via the jobflowid method:

    (Pdb) job().jobflowid returns: u'j-BZC0X65JLLEA'
    

    for the step id for a given step, you can use the list_steps method on the connection, for example:

    (Pdb) conn().list_steps('j-BZC0X65JLLEA').steps[-1].id returns: u's-1A1ASN2W23Y1L'
    

    Calling steps will give you a list of boto.emr.emrobject.StepSummary objects, you can iterate over those and pluck out what you need.