aleph-im / aleph-vm

Aleph.im VM execution engine
MIT License
43 stars 18 forks source link

ASGI Lifespan Protocol needs to be implemented #293

Closed MHHukiewitz closed 1 year ago

MHHukiewitz commented 1 year ago

Is your feature request related to a problem? Please describe. When using lifespan events for executing code on startup or shutdown of a VM, like described in the FastAPI Docs, then this will work on apps being run with uvicorn, but not when deployed on Aleph.

Describe the solution you'd like

Describe alternatives you've considered

Additional context Currently, timeouts are realized at the firecracker_microvm.py level:

return await asyncio.wait_for(
    communicate(reader, writer, scope),
    timeout=self.hardware_resources.seconds,
)

This should be rather on the VmExecution level, given that we might also use other VM jailers. If for any reason startup and shutdown procedures are taking longer than expected, then this should not go "unbilled".

hoh commented 1 year ago

This was merged.