Skip to content

Commit b2dd70f

Browse files
committed
refactor(boundary): move orchestrator/ -> agent/, controllers/ -> supervisor/controllers/
PR-3 of the agent/supervisor boundary work (behavior-neutral physical move). - src/aleph/vm/orchestrator/ -> src/aleph/vm/agent/ (the Aleph network agent). - src/aleph/vm/controllers/ -> src/aleph/vm/supervisor/controllers/ (the supervisor's execution worker; entry point becomes python -m aleph.vm.supervisor.controllers). - Update all imports, the console script (aleph.vm.agent.cli:main), and the systemd ExecStart targets. Service names and the %i-controller.json config path are unchanged. - Rework the import-linter contracts for the new layout: contract independent; controllers (now under supervisor) don't import the agent; the agent doesn't reach the supervisor daemon modules (composition root excepted); the supervisor doesn't import the agent (DB/aggregate-settings residuals documented). Stacked on PR-1 (#986). configuration.py already moved to contract/ in PR-1. Behavior-neutral: supervisor+migration suite 922 passed (only the pre-existing root-only test_interfaces failures remain), mypy baseline unchanged, lint-imports 4 kept / 0 broken.
1 parent 3dbbc76 commit b2dd70f

126 files changed

Lines changed: 531 additions & 526 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packaging/aleph-vm/etc/systemd/system/aleph-vm-agent.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ WorkingDirectory=/opt/aleph-vm
1010
Environment=PYTHONPATH=/opt/aleph-vm/:$PYTHONPATH
1111
Environment=PYTHONDONTWRITEBYTECODE="enabled"
1212
EnvironmentFile=/etc/aleph-vm/supervisor.env
13-
ExecStart=python3 -m aleph.vm.orchestrator --print-settings
13+
ExecStart=python3 -m aleph.vm.agent --print-settings
1414
Restart=on-failure
1515
RestartPreventExitStatus=0 130 143
1616
RestartSec=10s

packaging/aleph-vm/etc/systemd/system/aleph-vm-controller@.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ PrivateTmp=yes
1010
NoNewPrivileges=true
1111
WorkingDirectory=/opt/aleph-vm
1212
Environment=PYTHONPATH=/opt/aleph-vm/:$PYTHONPATH
13-
ExecStart=/usr/bin/python3 -m aleph.vm.controllers --config=/var/lib/aleph/vm/%i-controller.json
13+
ExecStart=/usr/bin/python3 -m aleph.vm.supervisor.controllers --config=/var/lib/aleph/vm/%i-controller.json
1414
Restart=on-failure
1515
# KillMode=Mixed is used so initially only the Python controller process receives the SIGTERM signal.
1616
# The controller catches it and sends an ACPI powerdown to the Guest VM, giving it time to shut down

pyproject.toml

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ urls.Discussions = "https://community.aleph.im/"
6969
urls.Documentation = "https://docs.aleph.cloud/nodes/compute/introduction/"
7070
urls.Issues = "https://github.com/aleph-im/aleph-vm/issues"
7171
urls.Source = "https://github.com/aleph-im/aleph-vm"
72-
scripts.aleph-vm = "aleph.vm.orchestrator.cli:main"
72+
scripts.aleph-vm = "aleph.vm.agent.cli:main"
7373

7474
[tool.hatch.version]
7575
source = "vcs"
@@ -280,9 +280,8 @@ type = "forbidden"
280280
allow_indirect_imports = "true"
281281
source_modules = [ "aleph.vm.supervisor_interface" ]
282282
forbidden_modules = [
283-
"aleph.vm.orchestrator",
283+
"aleph.vm.agent",
284284
"aleph.vm.supervisor",
285-
"aleph.vm.controllers",
286285
"aleph.vm.pool",
287286
"aleph.vm.models",
288287
"aleph.vm.network",
@@ -291,39 +290,47 @@ forbidden_modules = [
291290
]
292291

293292
[[tool.importlinter.contracts]]
294-
name = "controllers are a supervisor worker, not the agent or the daemon"
293+
name = "controllers do not import the agent"
295294
type = "forbidden"
296295
allow_indirect_imports = "true"
297-
source_modules = [ "aleph.vm.controllers" ]
298-
forbidden_modules = [ "aleph.vm.orchestrator", "aleph.vm.supervisor" ]
296+
source_modules = [ "aleph.vm.supervisor.controllers" ]
297+
forbidden_modules = [ "aleph.vm.agent" ]
299298

300299
[[tool.importlinter.contracts]]
301-
name = "the agent does not reach into the supervisor implementation"
300+
name = "the agent does not reach into the supervisor daemon"
302301
type = "forbidden"
303302
allow_indirect_imports = "true"
304-
source_modules = [ "aleph.vm.orchestrator" ]
305-
forbidden_modules = [ "aleph.vm.supervisor" ]
306-
# Composition root only: the agent entrypoints pick a concrete Supervisor impl
307-
# at startup. All other agent code goes through aleph.vm.supervisor_interface.abc.Supervisor.
303+
source_modules = [ "aleph.vm.agent" ]
304+
forbidden_modules = [
305+
"aleph.vm.supervisor.local",
306+
"aleph.vm.supervisor.grpc_server",
307+
"aleph.vm.supervisor.grpc_client",
308+
"aleph.vm.supervisor.daemon",
309+
"aleph.vm.supervisor.proto_convert",
310+
"aleph.vm.supervisor._pb",
311+
"aleph.vm.supervisor.error_mapping",
312+
"aleph.vm.supervisor.qemu_build",
313+
]
314+
# Composition root only: the agent entrypoints pick a concrete Supervisor impl.
315+
# Agent->supervisor.controllers (Resources, controller exception types, cloudinit)
316+
# remains a documented residual removed by PR-2 (the controller split).
308317
ignore_imports = [
309-
"aleph.vm.orchestrator.cli -> aleph.vm.supervisor.local",
310-
"aleph.vm.orchestrator.supervisor -> aleph.vm.supervisor.local",
311-
"aleph.vm.orchestrator.supervisor -> aleph.vm.supervisor.grpc_client",
318+
"aleph.vm.agent.cli -> aleph.vm.supervisor.local",
319+
"aleph.vm.agent.supervisor -> aleph.vm.supervisor.local",
320+
"aleph.vm.agent.supervisor -> aleph.vm.supervisor.grpc_client",
312321
]
313322

314323
[[tool.importlinter.contracts]]
315324
name = "the supervisor does not import the agent"
316325
type = "forbidden"
317326
allow_indirect_imports = "true"
318327
source_modules = [ "aleph.vm.supervisor", "aleph.vm.pool", "aleph.vm.models" ]
319-
forbidden_modules = [ "aleph.vm.orchestrator" ]
320-
# Residuals to be removed by the VmExecution/VmPool cleave + DB-layer extraction
321-
# (docs/plans/2026-05-28 section 4): the shared port-mappings persistence and the
322-
# aggregate-settings cache still live under orchestrator today.
328+
forbidden_modules = [ "aleph.vm.agent" ]
329+
# Residuals removed by the VmExecution/VmPool cleave + DB-layer extraction.
323330
ignore_imports = [
324-
"aleph.vm.models -> aleph.vm.orchestrator.metrics",
325-
"aleph.vm.pool -> aleph.vm.orchestrator.metrics",
326-
"aleph.vm.pool -> aleph.vm.orchestrator.utils",
327-
"aleph.vm.supervisor.daemon -> aleph.vm.orchestrator.metrics",
328-
"aleph.vm.supervisor.local -> aleph.vm.orchestrator.metrics",
331+
"aleph.vm.models -> aleph.vm.agent.metrics",
332+
"aleph.vm.pool -> aleph.vm.agent.metrics",
333+
"aleph.vm.pool -> aleph.vm.agent.utils",
334+
"aleph.vm.supervisor.daemon -> aleph.vm.agent.metrics",
335+
"aleph.vm.supervisor.local -> aleph.vm.agent.metrics",
329336
]
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)