jcozar
06/30/2021, 8:31 AMjcozar
06/30/2021, 9:07 AMMSG = "hello"
@task
def t1():
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(MSG)
with Flow("myflow") as f:
f1()
flow.register(project_name="...", idempotency_key=flow.serialized_hash())
Kevin Kho
flow.register(project_name="...", idempotency_key=flow.serialized_hash() + MSG)
?jcozar
06/30/2021, 3:13 PMNote that this will not always detect code changes since the task code is not included in the serialized flow sent to the server.
In my case, the global vars are used by the tasks, and therefore the hash does not change even if I modify the global var. However, based on your solution, I think I will get the hash string from the hole python file, because I only declare prefect resources in it (infrastructure is deployed independently). Thanks!