Apostolos Papafragkakis
06/21/2022, 10:56 AMAnna Geller
prefect version
2. Share flow we could use to reproduce the error
3. Share the traceback you're gettingApostolos Papafragkakis
06/21/2022, 11:33 AMFile "/home/user/.local/share/virtualenvs/deploytest-gAiUW3yO/lib/python3.9/site-packages/prefect/cli/deployment.py", line 153, in execute
if state.is_failed():
AttributeError: 'coroutine' object has no attribute 'is_failed'
Anna Geller
import asyncio
from prefect import task, flow
@task
async def print_values(values):
for value in values:
await asyncio.sleep(1) # yield
print(value, end=" ")
@flow
async def async_flow():
await print_values([1, 2]) # runs immediately
coros = [print_values("abcd"), print_values("6789")]
# asynchronously gather the tasks
await asyncio.gather(*coros)
if __name__ == "__main__":
asyncio.run(async_flow())
logs
13:36:32.779 | INFO | prefect.engine - Created flow run 'gray-bird' for flow 'async-flow'
13:36:32.780 | INFO | Flow run 'gray-bird' - Using task runner 'ConcurrentTaskRunner'
13:36:32.786 | WARNING | Flow run 'gray-bird' - No default storage is configured on the server. Results from this flow run will be stored in a temporary directory in its runtime environment.
13:36:32.812 | INFO | Flow run 'gray-bird' - Created task run 'print_values-94c2122e-0' for task 'print_values'
13:36:32.829 | INFO | Flow run 'gray-bird' - Created task run 'print_values-94c2122e-1' for task 'print_values'
13:36:32.849 | INFO | Flow run 'gray-bird' - Created task run 'print_values-94c2122e-2' for task 'print_values'
1 a 6 2 b 7 13:36:34.846 | INFO | Task run 'print_values-94c2122e-0' - Finished in state Completed()
c 8 d 9 13:36:36.850 | INFO | Task run 'print_values-94c2122e-1' - Finished in state Completed()
13:36:36.866 | INFO | Task run 'print_values-94c2122e-2' - Finished in state Completed()
13:36:36.877 | INFO | Flow run 'gray-bird' - Finished in state Completed('All states completed.')
Apostolos Papafragkakis
06/21/2022, 11:38 AMAnna Geller
DeploymentSpec(name="local", flow=async_flow)
Apostolos Papafragkakis
06/21/2022, 11:45 AMAnna Geller