Some functions are expensive because they launch an external code that has a large startup cost. We show how to modify that external code so that it stays alive and your Python function to know how to connect to it.
The short version:
- The Python function launches the external code and places links to the standard in and output in a cache
- The Python function sends inputs (or where to find them) via standard in
- The external process retrieves inputs
- The external process sends outputs (or where to find them) via standard out
- The Python function retrieves outputs
Note that this method requires heavy modifications on how the external code accepts inputs.
Full details are described in here: notebook