@@ -41,15 +41,15 @@ def interact(self, msg):
41
41
else :
42
42
input (msg )
43
43
44
- def update_resources (self ):
44
+ def update_resources (self , resources = None ):
45
45
"""
46
46
Iterate over all relevant resources and deactivate any active but
47
47
unavailable resources.
48
48
"""
49
49
if (monotonic () - self .last_update ) < 0.1 :
50
50
return
51
51
self .last_update = monotonic ()
52
- for resource in self .resources :
52
+ for resource in self .resources if resources is None else resources :
53
53
resource .poll ()
54
54
if not resource .avail and resource .state is BindingState .active :
55
55
deactivated = self .deactivate (resource )
@@ -71,7 +71,7 @@ def await_resources(self, resources, timeout=None, avail=True):
71
71
timeout (float): optional timeout
72
72
avail (bool): optionally wait until the resources are unavailable with avail=False
73
73
"""
74
- self .update_resources ()
74
+ self .update_resources (resources )
75
75
76
76
waiting = set (r for r in resources if r .avail != avail )
77
77
static = set (r for r in waiting if r .get_managed_parent () is None )
@@ -102,7 +102,7 @@ def await_resources(self, resources, timeout=None, avail=True):
102
102
filter = waiting
103
103
)
104
104
105
- self .update_resources ()
105
+ self .update_resources (resources )
106
106
107
107
def get_resource (self , cls , * , name = None , wait_avail = True ):
108
108
"""
0 commit comments