refactor(stall_watch): work out the herdr name once, in StallWatch (Issue #71)
StallWatch converts --target once and hands the name to HerdrSource, so agent get/read/prompt and agent wait cannot call herdr by different names. Refs #71 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4243da507c
commit
50e2998a20
1 file changed
+6
-5
@@ -155,11 +155,12 @@ class HerdrError(Exception):
|
||||
class HerdrSource(object):
|
||||
"""Every herdr and OS read the judgement needs, in one place."""
|
||||
|
||||
def __init__(self, target, agent, session=None):
|
||||
def __init__(self, target, agent, session=None, name=None):
|
||||
self.target, self.session = target, session or None
|
||||
# herdr knows the agent only by its sanitized name (#66); the kind is
|
||||
# read off the original name, whose suffix a long name's hash replaces.
|
||||
self.name = sanitize_herdr_agent_name(target)
|
||||
# `name` is the name herdr knows the agent by (#66), worked out once
|
||||
# by StallWatch (#71); the kind is read off the original name, whose
|
||||
# suffix a long name's hash replaces.
|
||||
self.name = name or target
|
||||
self.agent = resolve_agent(agent, target)
|
||||
adapter = get_adapter(self.agent) if self.agent else None
|
||||
self.resident = tuple(adapter.resident_children) if adapter else ()
|
||||
@@ -225,8 +226,8 @@ class HerdrSource(object):
|
||||
class StallWatch(object):
|
||||
def __init__(self, args, source=None):
|
||||
self.args = args
|
||||
self.src = source or HerdrSource(args.target, args.agent, args.herdr_session)
|
||||
self.herdr_name = sanitize_herdr_agent_name(args.target) # for herdr only; logs keep args.target
|
||||
self.src = source or HerdrSource(args.target, args.agent, args.herdr_session, name=self.herdr_name)
|
||||
name = resolve_agent(args.agent, args.target)
|
||||
adapter = get_adapter(name) if name else None
|
||||
reliable = bool(adapter.agent_status_reliable) if adapter else True
|
||||
|
||||
Reference in new issue
Block a user