https://prefect.io logo
t

tom

10/19/2020, 9:02 PM
Let’s say I raise
LOOP(result=X)
in my task and at some point I pause and resume that task (e.g. using
raise PAUSE()
within the task and then resuming in the UI). It seems like my task is resuming from the beginning and loses the loop context. Is there any way to make it keep the loop context? I tried doing
raise PAUSE(result=X)
but it would still resume from the beginning. Another question I have is if the result in
LOOP
needs to be small or if it there is a way to have a growing
Result
instance that potentially stores a lot of data.
k

Kyle Moon-Wright

10/19/2020, 9:27 PM
Hey @tom, I don't use the LOOP too much, but I can try to provide some insight here. For your first question, I believe this is expected behavior - entering a PAUSE state drops the hooks tracked by the LOOP states. I do think it's possible to implement in the way you described though, but would likely require some finagling with the LOOP signal/state source code itself. For your second question, you can persist the data from the LOOP iterations but you'd either create a file for each LOOP iteration or overwrite a file for each LOOP iteration. More information can be found here in the documentation.
👍 1