Skip to content
Browse files

target: poll resources directly

Instead of polling the managers for the resources, poll the resources
directly. This brings the usage more in line with how these resources
are polled in the exporter, allowing the usage of the USBSDMuxDevice in
local configurations again.

Signed-off-by: Rouven Czerwinski <>
  • Loading branch information...
Emantor authored and jluebbe committed Oct 27, 2019
1 parent 8f7b7c8 commit e8efb22e0eedc0265147270f7ebd09978c7640de
Showing with 7 additions and 9 deletions.
  1. +7 −9 labgrid/
@@ -8,7 +8,7 @@
from .binding import BindingError, BindingState
from .driver import Driver
from .exceptions import NoSupplierFoundError, NoDriverFoundError, NoResourceFoundError
from .resource import Resource
from .resource import Resource, ManagedResource
from .strategy import Strategy
from .util import Timeout

@@ -38,16 +38,15 @@ def interact(self, msg):

def update_resources(self):
Iterate over all relevant managers and deactivate any active but
Iterate over all relevant resources and deactivate any active but
unavailable resources.
if (monotonic() - self.last_update) < 0.1:
self.last_update = monotonic()
resources = [r for r in self.resources if r.get_managed_parent()]
managers = set(r.get_managed_parent().manager for r in resources)
for manager in managers:
resources = [r for r in self.resources if isinstance(r, ManagedResource)]
for resource in resources:
for resource in resources:
if not resource.avail and resource.state is"deactivating unavailable resource %s", resource.display_name) # pylint: disable=line-too-long
@@ -80,9 +79,8 @@ def await_resources(self, resources, timeout=None, avail=True):

while waiting and not timeout.expired:
waiting = set(r for r in waiting if r.avail != avail)
managers = set(r.get_managed_parent().manager for r in waiting)
for m in managers:
for r in waiting:
if not any(r for r in waiting if r.avail == avail):
# sleep if no progress

0 comments on commit e8efb22

Please sign in to comment.
You can’t perform that action at this time.