def create_collections()

in src/rekognition/setup/app.py [0:0]


def create_collections()->None:
  '''
  Create each of the Rekognition Collection Partitions
  '''
  for ix in range(0, total_collections):
    collection_id = '{}-{}'.format(riv_stack_name, ix)

    try:
      '''
      Check if the collection exists, or skip forward if already present.
      '''
      rek_client.describe_collection(CollectionId=collection_id)
      print('Collection {} already exists, nothing to do.'.format(collection_id))
      continue
    except rek_client.exceptions.ResourceNotFoundException as error:
      '''
      This error means the collection does not exist. Create it.
      '''
      response = rek_client.create_collection(
        CollectionId=collection_id,
        Tags={
          'riv_stack': riv_stack_name,
        })

      print('Created collection {} with Version {}'.format(collection_id, response['FaceModelVersion']))
    except Exception as error:
      '''
      These are hard failures (e.g., AccessDeniedException)
      '''
      print('Unable to describe_collection({})'.format(collection_id))
      raise error