Skip to content

Commit d69c3a9

Browse files
alexterceteidan-arm
authored andcommitted
remote/coordinator: report exporter command timeouts
Convert exporter acquire/release command timeouts into ExporterError failures. This returns a clear timeout reason to the client instead of relying on an empty TimeoutError message. Signed-off-by: Alex Tercete <alex.tercete@arm.com> Reviewed-by: Alex Tercete <alex.tercete@arm.com> # gatekeeper Co-authored-by: Idan Saadon <idan.saadon@arm.com>
1 parent 2fe34c5 commit d69c3a9

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

labgrid/remote/coordinator.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,10 @@ async def _acquire_resource(self, place, resource):
655655
request.place_name = place.name
656656
cmd = ExporterCommand(request)
657657
self.get_exporter_by_name(resource.path[0]).queue.put_nowait(cmd)
658-
await cmd.wait()
658+
try:
659+
await cmd.wait()
660+
except asyncio.TimeoutError as e:
661+
raise ExporterError("timed out waiting for exporter while acquiring resource") from e
659662
if not cmd.response.success:
660663
raise ExporterError(f"failed to acquire {resource} ({cmd.response.reason})")
661664
if resource.acquired != place.name:
@@ -727,13 +730,16 @@ async def _release_resources(self, place, resources, callback=True):
727730
# request.place_name is left unset to indicate release
728731
cmd = ExporterCommand(request)
729732
self.get_exporter_by_name(resource.path[0]).queue.put_nowait(cmd)
730-
await cmd.wait()
733+
try:
734+
await cmd.wait()
735+
except asyncio.TimeoutError as e:
736+
raise ExporterError("timed out waiting for exporter while releasing resource") from e
731737
if not cmd.response.success:
732738
raise ExporterError(f"failed to release {resource} ({cmd.response.reason})")
733739
if resource.acquired:
734740
logging.warning("resource %s still acquired after release request", resource)
735-
except (ExporterError, TimeoutError) as e:
736-
if failure is None or isinstance(e, ExporterError):
741+
except ExporterError as e:
742+
if failure is None:
737743
failure = e
738744
logging.exception("failed to release %s", resource)
739745
# at leaset try to notify the clients

0 commit comments

Comments
 (0)