Hello! Is flow registration to prefect cloud asynchronous? I am trying to register multiple flows concurrently. Are there any examples of that?
k
Kevin Kho
05/10/2022, 6:12 PM
The API only takes in one Flow so not really. Is it too slow for you? You are the one who has a CI/CD pipeline so you made a way to determine only the Flows with changes right?
j
Jake
05/10/2022, 6:16 PM
yeah that’s me. It’s still too slow 😞. I’m also curious what exactly goes into building the hash generated from
flow.serialized_hash()
. I’ve noticed that sometimes the hash changes even though there were no changes in the code. Does it have anything to do with the pickle? I noticed that even when there are no code changes, the pickles contents changed.
k
Kevin Kho
05/10/2022, 6:21 PM
That must mean you have something like
datetime.datetime.now()
in your schedule or something? Some timestamps that changes value from run to run
j
Jake
05/10/2022, 6:24 PM
That could be it actually; let me double check
Jake
05/13/2022, 6:39 PM
This works by the way — it’s somewhat faster.
Copy code
# where register_flows is a function that calls flow.register()
threads = []
for project in projects:
t = threading.Thread(
target=register_flows, args=(project)
)
threads.append(t)
t.start()
for thread in threads:
thread.join()
k
Kevin Kho
05/13/2022, 7:07 PM
Ah ok you could wrap the flow.register call in async too maybe
j
Jake
05/13/2022, 8:52 PM
Yeah that works! But I’m not sure how to await them from a CLI
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.