The following service callback utilizes id_allocator of the resource_manager package to request an id from the resource pool and then read the allocated id back when it is ready.
from resource_manager import id_allocator
@Service.create
def cb_create(self, tctx, root, service, proplist):
id_allocator.id_request(...)
id = id_allocator.id_read(...)
if not id:
print('id not ready, waiting for redeploy')
return
# get the id, save it
service.allocated_id = id
....
When the resource pool is exhausted, a LookupError exception will happen when the redeployment kicks in to read the id. But either from ncs_cli or northbound REST api will show this error since it's from a redeployment of the service. My question is that are there any ways to properly pass along the exceptions/errors to the users who launch the service so that they know the id request fail?
Thanks.