Hi all upgrading from 0.10.6 to 0.13.10 and lookin...
# prefect-server
e
Hi all upgrading from 0.10.6 to 0.13.10 and looking for some advice/clarification. We used create the flow with a context manager to setup task orders and register e.g.
Copy code
with Flow("Flow name") as flow:
   flow.add_task(abc)
   flow.register(project_name="Test")
In the latest version I find that this isn't possible anymore as I get a
TypeError: can't pickle generator objects
My solution has been to replace this by defining the the flow object directly and ditching the context manager e.g.
Copy code
flow = Flow("Flow name")
flow.add_task(abc)
flow.register(project_name="Test")
This works absolutely fine and I'm happy to continue with it. I just wanted to check if: 1. This is the expected / best way to resolve this problem 2. [Some of the documentation](https://docs.prefect.io/core/concepts/tasks.html#overview) still refers to the use of the context manager style. Is this okay to do simply because tese example do not register a flow? Any advice is welcome πŸ™‚ Thanks!
c
Hi Elliot - can you try registering your Flow outside of the context manager? E.g.,
Copy code
with Flow("Flow name") as flow:
   flow.add_task(abc)

flow.register(project_name="Test")
🦜 1
a
Hi @Elliot Oram! I’ve had a similar issue and solved by doing what @Chris White suggests
πŸ’― 2
e
Ah that's much cleaner! Thanks both πŸŽ‰
j
Hmmm, that's an odd error to result from that, we should look fix that to raise a nicer error. Will fix.
Thanks for reporting the issue! Glad you got things working.
a
First time it took me more or less 4h to figure out it was β€œjust” and indentation problem πŸ˜…
j