Hello, I have another question. It is possible to...
# prefect-community
Hello, I have another question. It is possible to ensure that no tasks start running unless all tasks have been successfully registered? For example, if I have some code registering tasks:
Copy code
1   A = Task(...).submit()
5   B = Task(...).submit(wait_for=[A])
9   _ = Task(...).submit(wait_for=[B])
If an except is throw after line 1 and before line 9, is there an easy way to ensure that Task "A" does not start?
Hi David, I presume this is question is about 2.0? If so, the registration process is not utilized for flows in 2.0. If you want to test each of the tasks before running them in prod, I'd recommend the unit testing approach. This will allow you to run your flows and tasks against a temporary local SQLite database. In theory, you could test Task A using
as suggested at the bottom of the article.
Oh yes this is for Prefect 2, but it is not about testing. I need to make task registration "atomic" in the sense that if my flow code fails, so I don't have some tasks execute while others don't exist (this would be worst than having no tasks run).
When I said "registration" I mean I am in the flow, and creating & running the tasks. This is at flow runtime.