def show_execution_attempts()

in content/rendering-with-batch/rendering-with-batch.files/verifying_resilience.py [0:0]


def show_execution_attempts(job_ids):
    """Shows the number of atemmps of the specified jobs,
    if the attempt number is bigger than 1.

    Keyword arguments:
    job_ids -- Identifiers of the target jobs
    """

    client = boto3.client('batch')
    page = 0
    items_per_page = 100

    while page * items_per_page < len(job_ids):
        start_index = page * items_per_page
        end_index = start_index + items_per_page
        page += 1

        response = client.describe_jobs(
            jobs=job_ids[start_index:end_index]
        )

        for job in response['jobs']:
            if len(job['attempts']) > 1:
                print('Frame\t{}\twas attempted to render {} times'.format(job['arrayProperties']['index'], len(job['attempts'])))