What would be the approach to conditionally regist...
# ask-community
s
What would be the approach to conditionally register a flow depending on both the flow itself and the tasks used by the flow? So, the
idempotency_key
used when calling
flow.register()
would take into account both flow and task changes. From what I can tell,
flow.serialized_hash()
only changes if changes are made to the flow's metadata. It does not take into account if a task within a flow changes.
z
Hey @Samuel Kohlleffel you could hash the code of all the task objects in the flow if this is something you desire. Just fyi, if the metadata does not change, registering has no real effect though except incrementing the version number.
s
Sorry, I meant I only want to build flows that have task code modified. Our use case is we will have developers working on different flows in separate feature branches. Right now, if a developer only makes updates to the task code of a flow and doesn't modify the actual flow itself, I assume those changes will not be caught and therefore the flow will not be built when registering and building the flow with
idempotency_key = flow.serialized_hash()
. For CI, we have a build script that builds and registers all of the modified flows, but right now it only builds and registers if the flow metadata has changed because as I stated above we are usingĀ 
idempotency_key = flow.serialized_hash()
. So my question is: is there any way to build flows in an idempotent way that checks for changes to the task code and also any functions that are used by the tasks?
z
I actually don't think that we skip the build step dependent on the idempotency key as that key is only used for registration.
s
Ok, I can right some custom functionality to skip the build based on a key no problem (maybe utilizing the KV store). The issue still remains that I want to build flows and register them anytime the tasks, functions used by the tasks, or the flow itself change. I'm not sure how to go about this. Is the only way to somehow generate a hash of the flow, tasks, and functions used in the tasks?