Malavika S Menon
09/09/2022, 6:29 AMdef random_fn():
print("Random")
@flow
def main_flow():
prefect_flow = Flow(name="random_flow", fn=random_fn)
deployment = Deployment.build_from_flow(
flow=prefect_flow,
name=random_deploy,
version=1,
work_queue_name="test-queue",
)
deployment.apply()
I'm trying to build a deployment for a flow that is created dynamically. While the deployment 'random_flow' gets created successfully, when I try to run the same, I get this error.
Flow could not be retrieved from deployment.
Traceback (most recent call last):
File "/home/malavika/.virtualenvs/lib/python3.8/site-packages/prefect/engine.py", line 256, in retrieve_flow_then_begin_flow_run
flow = await load_flow_from_flow_run(flow_run, client=client)
File "/home/malavika/.virtualenvs/lib/python3.8/site-packages/prefect/client.py", line 103, in with_injected_client
return await fn(*args, **kwargs)
File "/home/malavika/.virtualenvs/lib/python3.8/site-packages/prefect/deployments.py", line 54, in load_flow_from_flow_run
await storage_block.get_directory(from_path=deployment.path, local_path=".")
File "/home/malavika/.virtualenvs/lib/python3.8/site-packages/prefect/filesystems.py", line 134, in get_directory
shutil.copytree(from_path, local_path, dirs_exist_ok=True)
File "/usr/lib/python3.8/shutil.py", line 555, in copytree
with os.scandir(src) as itr:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpbkxm8cdtprefect'
What can be done to link this flow to the deployment properly and get it to run through the Orion UI?Serina
09/09/2022, 7:08 PMfrom prefect import flow
from prefect.deployments import Deployment
@flow
def random_flow():
print("Random")
@flow
def main_flow():
deployment = Deployment.build_from_flow(
flow=random_flow,
name="random_deploy",
version=1,
work_queue_name="test-queue",
)
deployment.apply()
main_flow()