DEV Community

haimzlato
haimzlato

Posted on

Hacking the Python Import System and Rewriting the AST For Durable Execution

At AutoKitteh, we run users’ Python code as-is in a way that can redo parts of the execution in case of failures.
This article explains the magic.

In a nutshell, AutoKitteh uses Temporal to run the user code. It takes the user code and converts functions, such as ml.enrich, into temporal activities. The user code changes function call from event = ml.enrich(event) to event = _ak_call(ml.encrich, event) Where _ak_call does the following:

Image description

This magic is implemented by AST rewriting.
For more information, read the article.

Top comments (0)