Skip to content

Commit 7989ffe

Browse files
authored
Merge pull request #1653 from jluebbe/revert-resource-update
fix inconsistent driver states by reverting #1638
2 parents 4cbe4bc + 412f0a6 commit 7989ffe

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

labgrid/target.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,16 @@ def interact(self, msg):
4141
else:
4242
input(msg)
4343

44-
def update_resources(self, resources=None):
44+
def update_resources(self):
4545
"""
46-
Iterate over all relevant resources and deactivate any active but
47-
unavailable resources.
46+
Iterate over this target's resources, deactivate any active but
47+
unavailable resources and also deactivate any drivers using them.
48+
This ensures a consistent binding states for this target.
4849
"""
4950
if (monotonic() - self.last_update) < 0.1:
5051
return
5152
self.last_update = monotonic()
52-
for resource in self.resources if resources is None else resources:
53+
for resource in self.resources:
5354
resource.poll()
5455
if not resource.avail and resource.state is BindingState.active:
5556
deactivated = self.deactivate(resource)
@@ -71,7 +72,7 @@ def await_resources(self, resources, timeout=None, avail=True):
7172
timeout (float): optional timeout
7273
avail (bool): optionally wait until the resources are unavailable with avail=False
7374
"""
74-
self.update_resources(resources)
75+
self.update_resources()
7576

7677
waiting = set(r for r in resources if r.avail != avail)
7778
static = set(r for r in waiting if r.get_managed_parent() is None)
@@ -102,7 +103,7 @@ def await_resources(self, resources, timeout=None, avail=True):
102103
filter=waiting
103104
)
104105

105-
self.update_resources(resources)
106+
self.update_resources()
106107

107108
def get_resource(self, cls, *, name=None, wait_avail=True):
108109
"""

0 commit comments

Comments
 (0)