************** ``async_bulk`` ************** The registries create, replace and delete many descriptors at once in bulk operations, which run asynchronously: the server accepts the request, and gives a handle. :py:mod:`aas_client3_2.async_bulk` implements the Async Bulk Status API and the Async Bulk Result API, with which you follow the handle, on the same registry. .. code-block:: python import time import requests import aas_core3_2.types as aas_types from aas_client3_2 import ( async_bulk as aas_client_async_bulk, http as aas_client_http, requests_transport as aas_client_requests_transport, submodel_registry as aas_client_submodel_registry, ) server = aas_client_http.Server( transport=aas_client_requests_transport.RequestsTransport( requests.Session() ), base_url="http://localhost:5008", ) identifiers = [ "https://example.com/ids/sm/getting-started/bulk/0", "https://example.com/ids/sm/getting-started/bulk/1", "https://example.com/ids/sm/getting-started/bulk/2", ] descriptors = [] for identifier in identifiers: descriptor = aas_types.SubmodelDescriptor( id=identifier, endpoints=[ aas_types.Endpoint( interface="SUBMODEL-3.2", protocol_information=aas_types.ProtocolInformation( href="http://localhost:5005/submodels/" + aas_client_http.encode_base64url(identifier), ), ) ], ) descriptors.append(descriptor) handle = aas_client_submodel_registry.bulk_post_submodel( server, descriptors ) Poll the status until the operation is finished, waiting as long as the server asks: .. code-block:: python def wait_for(handle: aas_types.OperationHandle) -> None: while True: status = aas_client_async_bulk.bulk_get_async_status( server, handle.handle_id ) if status.finished: break time.sleep(status.retry_after or 1) # Raises an error if the bulk operation failed. aas_client_async_bulk.bulk_get_async_result( server, handle.handle_id ) wait_for(handle) The bulk operation succeeds or fails as a whole. Delete the descriptors in bulk as well: .. code-block:: python wait_for( aas_client_submodel_registry.bulk_delete_submodel_descriptors_by_id( server, identifiers ) ) The AAS Registry offers the same bulk operations for the descriptors of the shells, in :py:mod:`aas_client3_2.aas_registry`.