Hi <#CM28LL405|> <#C048ZHT5U3U|>, Got Runtime erro...
# prefect-cloud
a
Hi #CM28LL405 #C048ZHT5U3U, Got Runtime error as task runner is already started in below scenario
Copy code
@flow(name="Status check")
def run():
    a= "hello"
    if(condition):
        success
    else:
        run()

if __name__ == "__main__":
   run()
Can anyone help. This is more like recursive funtion
j
Couldn’t you achieve this with a while loop? What would be the reason to recursively call a flow?
a
Copy code
@flow(name="Status check")
def run():
    a= task1 output

    if(task1 output condition):
        running other task2
    else:
       wait(10)
        run()
this is exact sudo code
I am checking status in time manner
@James Sopkin Cant use recursive
?
j
I don't believe it is possible to recursively call a flow. Could you try something like this?
Copy code
@flow(name="Status check")
def run():
  a = task1()
  while a != condition:
     a = task1()
     wait(10)
  task2()
a
I did the same . but it is repeated code. I think even I cant use nested task
j
Could you post the logs? I tried doing something similar and it works fine