From a653c4431d09beb67719317d073951df9655e8ff Mon Sep 17 00:00:00 2001 From: Olivier Le Thanh Duong Date: Tue, 16 Sep 2025 15:36:20 +0200 Subject: [PATCH 1/2] WIP ALEPH-615 Expose resources for executions --- src/aleph/vm/orchestrator/supervisor.py | 2 ++ src/aleph/vm/orchestrator/views/__init__.py | 31 +++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/src/aleph/vm/orchestrator/supervisor.py b/src/aleph/vm/orchestrator/supervisor.py index b8f3061f..d09c1e86 100644 --- a/src/aleph/vm/orchestrator/supervisor.py +++ b/src/aleph/vm/orchestrator/supervisor.py @@ -47,6 +47,7 @@ status_check_version, status_public_config, update_allocations, + list_executions_resources, ) from .views.operator import ( operate_confidential_initialize, @@ -128,6 +129,7 @@ def setup_webapp(pool: VmPool | None): web.get("/about/login", about_login), web.get("/about/executions/list", list_executions), web.get("/v2/about/executions/list", list_executions_v2), + web.get("/about/executions/resources", list_executions_resources), web.get("/about/executions/details", about_executions), web.get("/about/executions/records", about_execution_records), web.get("/about/usage/system", about_system_usage), diff --git a/src/aleph/vm/orchestrator/views/__init__.py b/src/aleph/vm/orchestrator/views/__init__.py index a964b72a..26e7cd75 100644 --- a/src/aleph/vm/orchestrator/views/__init__.py +++ b/src/aleph/vm/orchestrator/views/__init__.py @@ -228,6 +228,37 @@ async def list_executions_v2(request: web.Request) -> web.Response: ) + +@cors_allow_all +async def list_executions_resources(request: web.Request) -> web.Response: + """List all executions with detail on their resource usage""" + pool: VmPool = request.app["vm_pool"] + + return web.json_response( + { + item_hash: { + "networking": ( + { + "ipv4_network": execution.vm.tap_interface.ip_network, + "host_ipv4": pool.network.host_ipv4, + "ipv6_network": execution.vm.tap_interface.ipv6_network, + "ipv6_ip": execution.vm.tap_interface.guest_ipv6.ip, + "ipv4_ip": execution.vm.tap_interface.guest_ip.ip, + "mapped_ports": execution.mapped_ports, + } + if execution.vm and execution.vm.tap_interface + else {} + ), + "status": execution.times, + "message": execution.message, + "resources": execution.resources, + } + for item_hash, execution in pool.executions.items() + }, + dumps=dumps_for_json, + ) + + @cors_allow_all async def about_config(request: web.Request) -> web.Response: authenticate_request(request) From c515807bf53b834163527c0a34e511e7a3a79b6e Mon Sep 17 00:00:00 2001 From: Olivier Le Thanh Duong Date: Thu, 18 Sep 2025 15:33:31 +0200 Subject: [PATCH 2/2] fix formating --- src/aleph/vm/orchestrator/supervisor.py | 2 +- src/aleph/vm/orchestrator/views/__init__.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/aleph/vm/orchestrator/supervisor.py b/src/aleph/vm/orchestrator/supervisor.py index d09c1e86..646f3819 100644 --- a/src/aleph/vm/orchestrator/supervisor.py +++ b/src/aleph/vm/orchestrator/supervisor.py @@ -34,6 +34,7 @@ about_login, debug_haproxy, list_executions, + list_executions_resources, list_executions_v2, notify_allocation, operate_reserve_resources, @@ -47,7 +48,6 @@ status_check_version, status_public_config, update_allocations, - list_executions_resources, ) from .views.operator import ( operate_confidential_initialize, diff --git a/src/aleph/vm/orchestrator/views/__init__.py b/src/aleph/vm/orchestrator/views/__init__.py index 26e7cd75..336cdda5 100644 --- a/src/aleph/vm/orchestrator/views/__init__.py +++ b/src/aleph/vm/orchestrator/views/__init__.py @@ -228,7 +228,6 @@ async def list_executions_v2(request: web.Request) -> web.Response: ) - @cors_allow_all async def list_executions_resources(request: web.Request) -> web.Response: """List all executions with detail on their resource usage"""