Hey all, new to Prefect and trying to find analogies with the Web framework world. A few questions:
• Web frameworks have the concept of a global "app" object which serves as a container of all routes/controllers etc. Is there an equivalent in Prefect, i.e. an object that encapsulates all flows/tasks? I'm guessing no but just wanted to double check.
• Another common web framework feature is "middleware", functions that wrap around a router handler function (or other middleware). The closest I found in Prefect docs is the
state change hooks but they seem more limited in that (a) they run only
after the flow/task, not before, and (b) they run only for a given state (e.g. failure), not unconditionally (though I guess you can pass the same hook to all four hook params so that's less problematic).
• Finally frameworks often provide a way for storing transient (request lifespan) data, e.g.
flask.g
in Flask or
request.state
in Starlette. Prefect exposes a "runtime context", which looks parallel to the web request but afaict it's immutable, or at least not supposed to be writable by user flows/tasks. Is this possible or all data has to be passed explicitly as function parameters?
Thanks for any help!