Magpie and external subsystems
A conscious design choice for Magpie was that all nanotransactions would be synchronous and run to completion. Now that we are expanding the scope of Magpie from a runtime where all user code is implemneted and executed directly inside the runtime to a more general-purpose distributed orchestrator, we need to expand the epic execution model to allow for delegated tasks, or tasks that are submitted to an external component which might respond at some unknown time in the future.
One choice for this would be to simply allow nanotransactions to interact with these external subsystems, blocking until some condition is met (e.g. an external program returns a result or finishes execution). While this is the simplest option, it could potentially lead to indefinite blocking of executor threads and consequently an increase in latency for tasks in their queues. Instead, we introduce the concept of async tasks which are managed by the runtime's async worker pool and seamlessly integrate into the epic task graph. While an async task is executing, executor threads are free to continue processing other nanotransactions.
Async tasks allow the runtime to interact with external components. For instance, we can launch an external executable, let it run until it produces a result, and then consume its output inside of downstream nanotransactions. They also allow us to orchestrate external long-running processes, like containers or databases. This in turns enables us to use magpie as a control plane for distributing systems that were not meant to be distributed. As an example of how this could work, in this doc we outline how we would approach partitioning and query planning over unmodified versions of Redis and DuckDB.