Skip to content

Commit

Permalink
remote/exporter: add poll tracking override
Browse files Browse the repository at this point in the history
The poll() function tracks whether the local information has changed vs
the previous state and only takes the availability into account. Since
we now poll() the resource on creation, the local state is immediately
updated with the information on the resource. This also means that
instead of a "clear" by sending an unavailable resource, we don't send an
update to the exporter in case the resource is still available.

Previously:
Create Resource -> unavailable
poll() -> update to coordinator

Now:
create resource, poll() -> availability stays the same and we skip the
information update.

Add an explicit override to the poll function to mark the state as dirty
for the first poll().

Signed-off-by: Rouven Czerwinski <[email protected]>
  • Loading branch information
Emantor committed Mar 4, 2025
1 parent 2ce9e24 commit aeeb0a7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions labgrid/remote/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def stop(self):
raise
self.start_params = None

def poll(self):
def poll(self, dirty=False):
# poll and check for updated params/avail
self.local.poll()

Expand All @@ -154,7 +154,6 @@ def poll(self):
self.stop()

# check if resulting information has changed
dirty = False
if self.avail != (self.local.avail and not self.broken):
self.data["avail"] = self.local.avail and not self.broken
dirty = True
Expand Down Expand Up @@ -1003,7 +1002,7 @@ async def add_resource(self, group_name, resource_name, cls, params):
res = group[resource_name] = export_cls(
config, host=self.hostname, proxy=getfqdn(), proxy_required=proxy_req
)
res.poll()
res.poll(dirty=True)
else:
config["params"]["extra"] = {
"proxy": getfqdn(),
Expand Down

0 comments on commit aeeb0a7

Please sign in to comment.