Skip to content

Commit 183925c

Browse files
authored
Merge branch 'main' into ol-IGNORE_TRACEBACK_FROM_DIAGNOSTICS-broken
2 parents e259b25 + 5acbdef commit 183925c

File tree

4 files changed

+16
-31
lines changed

4 files changed

+16
-31
lines changed

packaging/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ debian-package-code:
1515
cp ../examples/instance_message_from_aleph.json ./aleph-vm/opt/aleph-vm/examples/instance_message_from_aleph.json
1616
cp -r ../examples/data ./aleph-vm/opt/aleph-vm/examples/data
1717
mkdir -p ./aleph-vm/opt/aleph-vm/examples/volumes
18-
pip3 install --target ./aleph-vm/opt/aleph-vm/ 'aleph-message==0.4.9' 'eth-account==0.10' 'sentry-sdk==1.31.0' 'qmp==1.1.0' 'aleph-superfluid~=0.2.1' 'sqlalchemy[asyncio]>=2.0' 'aiosqlite==0.19.0' 'alembic==1.13.1' 'aiohttp_cors==0.7.0' 'pyroute2==0.7.12' 'python-cpuid==0.1.0' 'solathon==1.0.2'
18+
pip3 install --progress-bar off --target ./aleph-vm/opt/aleph-vm/ 'aleph-message==0.5.0' 'eth-account==0.10' 'sentry-sdk==1.31.0' 'qmp==1.1.0' 'aleph-superfluid~=0.2.1' 'sqlalchemy[asyncio]>=2.0' 'aiosqlite==0.19.0' 'alembic==1.13.1' 'aiohttp_cors==0.7.0' 'pyroute2==0.7.12' 'python-cpuid==0.1.0' 'solathon==1.0.2'
1919
python3 -m compileall ./aleph-vm/opt/aleph-vm/
2020

2121
debian-package-resources: firecracker-bins vmlinux download-ipfs-kubo target/bin/sevctl
@@ -47,8 +47,7 @@ download-ipfs-kubo: target-dir build-dir
4747
curl -fsSL https://github.com/ipfs/kubo/releases/download/v0.23.0/kubo_v0.23.0_linux-amd64.tar.gz | tar -xz --directory ./target/kubo
4848

4949
target/bin/sevctl:
50-
# Release 0.4.3 matches revision c41c9172be013d6f10b9e1d7286fcb021805d5a5
51-
cargo install --git https://github.com/virtee/sevctl.git --rev c41c9172be013d6f10b9e1d7286fcb021805d5a5 --target x86_64-unknown-linux-gnu --root ./target
50+
cargo install --git https://github.com/virtee/sevctl.git --rev v0.6.0 --target x86_64-unknown-linux-gnu --root ./target
5251
./target/bin/sevctl -V
5352

5453
version:
@@ -145,6 +144,6 @@ repository-noble:
145144
cd ./repositories/noble && reprepro -Vb . includedeb noble ../../target/aleph-vm.ubuntu-24.04.deb && cd ..
146145

147146
repositories: repository-bookworm repository-jammy repository-noble
148-
147+
149148
all-podman: all-podman-debian-12 all-podman-ubuntu-2204 all-podman-ubuntu-2404 repositories
150149

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies = [
3636
"aioredis==1.3.1",
3737
"aiosqlite==0.19",
3838
"alembic==1.13.1",
39-
"aleph-message==0.4.9",
39+
"aleph-message==0.5",
4040
"aleph-superfluid~=0.2.1",
4141
"dbus-python==1.3.2",
4242
"eth-account~=0.10",

src/aleph/vm/orchestrator/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from aleph.vm.conf import ALLOW_DEVELOPER_SSH_KEYS, make_db_url, settings
2121
from aleph.vm.models import VmExecution
2222
from aleph.vm.pool import VmPool
23-
from aleph.vm.version import get_version_from_apt, get_version_from_git
23+
from aleph.vm.version import __version__, get_version_from_apt, get_version_from_git
2424

2525
from . import metrics, supervisor
2626
from .pubsub import PubSub
@@ -325,6 +325,7 @@ def main():
325325
# of transactions for performance monitoring.
326326
# We recommend adjusting this value in production.
327327
traces_sample_rate=1.0,
328+
release=__version__,
328329
)
329330
sentry_sdk.set_context(
330331
"version",

src/aleph/vm/pool.py

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,13 @@
2828

2929

3030
class VmPool:
31-
"""Pool of VMs already started and used to decrease response time.
31+
"""Pool of existing VMs
32+
33+
For function VM we keep the VM a while after they have run, so we can reuse them and thus decrease response time.
3234
After running, a VM is saved for future reuse from the same function during a
3335
configurable duration.
34-
35-
The counter is used by the VMs to set their tap interface name and the corresponding
36-
IPv4 subnet.
3736
"""
3837

39-
counter: int # Used to provide distinct ids to network interfaces
4038
executions: dict[ItemHash, VmExecution]
4139
message_cache: dict[str, ExecutableMessage]
4240
network: Network | None
@@ -45,7 +43,6 @@ class VmPool:
4543
creation_lock: asyncio.Lock
4644

4745
def __init__(self, loop: asyncio.AbstractEventLoop):
48-
self.counter = settings.START_ID_INDEX
4946
self.executions = {}
5047
self.message_cache = {}
5148

@@ -150,25 +147,13 @@ def get_unique_vm_id(self) -> int:
150147
This identifier is used to name the network interface and in the IPv4 range
151148
dedicated to the VM.
152149
"""
153-
_, network_range = settings.IPV4_ADDRESS_POOL.split("/")
154-
available_bits = int(network_range) - settings.IPV4_NETWORK_PREFIX_LENGTH
155-
self.counter += 1
156-
if self.counter < 2**available_bits:
157-
# In common cases, use the counter itself as the vm_id. This makes it
158-
# easier to debug.
159-
return self.counter
160-
else:
161-
# The value of the counter is too high and some functions such as the
162-
# IPv4 range dedicated to the VM do not support such high values.
163-
#
164-
# We therefore recycle vm_id values from executions that are not running
165-
# anymore.
166-
currently_used_vm_ids = {execution.vm_id for execution in self.executions.values()}
167-
for i in range(settings.START_ID_INDEX, 255**2):
168-
if i not in currently_used_vm_ids:
169-
return i
170-
msg = "No available value for vm_id."
171-
raise ValueError(msg)
150+
# Take the first id that is not already taken
151+
currently_used_vm_ids = {execution.vm_id for execution in self.executions.values()}
152+
for i in range(settings.START_ID_INDEX, 255**2):
153+
if i not in currently_used_vm_ids:
154+
return i
155+
msg = "No available value for vm_id."
156+
raise ValueError(msg)
172157

173158
def get_running_vm(self, vm_hash: ItemHash) -> VmExecution | None:
174159
"""Return a running VM or None. Disables the VM expiration task."""

0 commit comments

Comments
 (0)