Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/aleph/vm/orchestrator/supervisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
about_login,
debug_haproxy,
list_executions,
list_executions_resources,
list_executions_v2,
notify_allocation,
operate_reserve_resources,
Expand Down Expand Up @@ -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),
Expand Down
30 changes: 30 additions & 0 deletions src/aleph/vm/orchestrator/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,36 @@ 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)
Expand Down
Loading