Skip to main content

Module exec

Module exec 

Source
Expand description

Running a graph the model described.

run_pipeline and run_study used to echo their arguments back. The reason given was that the server cannot load user code — true of the server, which is a Rust binary, and irrelevant: Soma already runs Python filters in a subprocess everywhere else it needs to (that is what soma-worker is). This does the same thing, with the project directory on sys.path, so a model can build a graph out of the filters it just read with read_filter_source and actually run it.

The subprocess writes its answer to a file rather than stdout, because a print inside a user’s filter is the most natural thing in the world to write and must not corrupt the reply. Stdout and stderr come back as diagnostics either way.

This executes code from the project directory. So does write_filter_source, which the same server has always offered — the model could already write a filter and ask the user to run it. What changes is the loop’s length, not who is trusted.

Structs§

GraphRunner
Runs a graph spec in a Python subprocess rooted at the project.