Is there a reason that flow.result and flow.execut...
# ask-community
x
Is there a reason that flow.result and flow.executor are not serialized for flow.register, unlike flow.run_config and flow.storage?
k
Hey @xyzy, I’ll follow up if I find a better answer but I think this is because different results need different types of serializers. Is there a use case you’re asking this for?
x
I'm using a script to register flows for the server and would like to keep the main flow files DRY. Currently I need to specify to Executor used by server in the top level of the flow py and the Executor used for direct local execution inside the
if __name__ == "__main__
branch that also calls flow.run
k
I think I get what you mean, but could you give me a simple flow with the
if __name__ == "__main__"
and the Executor being defined?
Also the script to register flows would help.
I took a look. This all looks good. I don’t see another way other than to overwrite the executor like what you’re doing. The only thing I’ll mention is that we have a Prefect CLI for registering flows that might help. https://docs.prefect.io/api/latest/cli/register.html . Is there something in your register script that isn’t covered?
x
Hi Kevin, the script does a few things thant can't be done with the CLI tool... E.g. automatically selecting project names, storage, run_config and applying schedules or kubernetes spec files depending on the execution mode and what's defined in the flow file
👍 1
k
Got it