https://prefect.io logo
Title
t

Timo

02/04/2021, 8:21 AM
Hi there, I've got a question about
flow.register( idempotency_key=flow.serialized_hash(),...)
. If I register my flows with this method, then, if I change the code of a single task, it creates no new version. Only if I make a change at the flow itself. Is it possible to make a new version if the code of the task changes (but not every time, like without idempotency_key)? Thanks
z

Zanie

02/04/2021, 4:56 PM
hi @Timo -- this is expected behavior. The serialized hash is the hash of the flow metadata that is sent to cloud which does not contain your code. If you want to register a new version every time the code is changed I'd recommend writing your own function that hashes the files with your tasks in them. Here's the docstring for
serialized_hash
Generate a deterministic hash of the serialized flow. This is useful for determining if the flow has changed. If this hash is equal to a previous hash, no new information would be passed to the server on a call to flow.register()

Note that this will not always detect code changes since the task code is not included in the serialized flow sent to the server. That said, as long as the flow is "built" during registration, the code changes will be in effect even if a new version is not registered with the server.
1
t

Timo

02/05/2021, 12:27 PM
Thank you for the answer