def get_jobs_in_array()

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


def get_jobs_in_array(array_id):
    """Returns the identifiers of the jobs inside an array job

    Keyword arguments:
    array_id -- identifier of the array job
    """

    client = boto3.client('batch')
    kwargs = {'arrayJobId': array_id, 'jobStatus': 'SUCCEEDED'}
    job_ids = []

    while True:
        response = client.list_jobs(**kwargs)
        job_ids += [job['jobId'] for job in response['jobSummaryList']]

        if 'nextToken' in response:
            kwargs['nextToken'] = response['nextToken']
        else:
            return job_ids