Watchers¶
xcore_agent.agent.watcher and xcore_agent.agent.marketplace_watcher — the
CI/CD loops that poll a Hub and redeploy on version change.
Watcher (.xdeploy flow)¶
xcore_agent.agent.watcher
¶
Polls XCore Hub for the latest version/tag of a project and redeploys
automatically when it changes — the "CI/CD" loop: Hub publishes a new
release, the agent notices on its own and rolls it out without a human
running xcore-agent deploy by hand. Runs garbage collection after every
successful redeploy so snapshots and cached downloads don't grow unbounded.
WatchResult
dataclass
¶
Source code in xcore_agent/agent/watcher.py
Watcher
¶
Source code in xcore_agent/agent/watcher.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
__init__(*, hub: HubClient, credentials: DeploymentCredentials, workdir_root: Path, project_root: Path, trusted_signer_public_key: bytes, keep_snapshots: int = 3, supervisor: Supervisor | None = None, plugin_resolver: PluginResolver | None = None, provisioners: dict[str, Provisioner] | None = None, notifiers: dict[str, Notifier] | None = None) -> None
¶
Source code in xcore_agent/agent/watcher.py
check_once() -> WatchResult
async
¶
Source code in xcore_agent/agent/watcher.py
watch_forever(*, interval_seconds: float, on_result: Callable[[WatchResult], None] | None = None, on_error: Callable[[Exception], None] | None = None, stop_after: Callable[[], Awaitable[bool]] | None = None) -> None
async
¶
Loop check_once() every interval_seconds. A failed tick (Hub
unreachable, a bad redeploy) must not kill the loop — that would
defeat the point of an unattended CI/CD watcher — so errors go to
on_error instead of propagating. stop_after is an injectable
exit condition for tests; real callers just never pass it.
Source code in xcore_agent/agent/watcher.py
MarketplaceWatcher (marketplace flow)¶
xcore_agent.agent.marketplace_watcher
¶
CI/CD watch loop for the real xcore-team/marketplace flow — the
counterpart to agent.watcher.Watcher for MarketplaceClient /
MarketplaceDeploymentRunner instead of the invented HubClient contract.
Polls GET /{plugins|services}/{slug} for latest_version and redeploys
through MarketplaceDeploymentRunner whenever it changes from what
StateStore says is currently installed — same version-change-detection
and GC-after-redeploy shape as Watcher, just against the Marketplace's
one-slug-per-deployment model instead of a multi-plugin project bundle (see
marketplace_client.py's module docstring for why that's a separate client
and pipeline in the first place).
MarketplaceWatchResult
dataclass
¶
Source code in xcore_agent/agent/marketplace_watcher.py
MarketplaceWatcher
¶
Source code in xcore_agent/agent/marketplace_watcher.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | |
__init__(*, client: MarketplaceClient, slug: str, trusted_signer_secret: bytes, install_plan_path: Path, workdir_root: Path, project_root: Path, kind: Kind = 'plugin', host_id: str = 'default', keep_snapshots: int = 3, supervisor: Supervisor | None = None, provisioners: dict[str, Provisioner] | None = None, notifiers: dict[str, Notifier] | None = None) -> None
¶
Source code in xcore_agent/agent/marketplace_watcher.py
check_once() -> MarketplaceWatchResult
async
¶
Source code in xcore_agent/agent/marketplace_watcher.py
watch_forever(*, interval_seconds: float, on_result: Callable[[MarketplaceWatchResult], None] | None = None, on_error: Callable[[Exception], None] | None = None, stop_after: Callable[[], Awaitable[bool]] | None = None) -> None
async
¶
Loop check_once() every interval_seconds. A failed tick (Hub
unreachable, a bad redeploy) must not kill the loop — errors go to
on_error instead of propagating. stop_after is an injectable exit
condition for tests; real callers just never pass it.