Hi All. I'm getting a value error when deploying f...
# ask-community
a
Hi All. I'm getting a value error when deploying flows outside of working directory, which is already flagged as an issue https://github.com/PrefectHQ/prefect/issues/6777 created by @Cole Murray. Could you please advise if there is any progress on that? Is there a way to go around this error? 🤔
c
Hi Anna, I was able to resolve this by overriding the entrypoint parameter as part of the Deployment.build_from_flow call. Below is a code snippet of how it can be used. There’s a few other techniques depending on your use-case, but in general providing an override for the entrypoint is probably what you want.
Copy code
module, method = module_name.rsplit('.', 1)
        mod = importlib.import_module(module)
        workflow_flow = getattr(mod, method)
        flow_filepath = getattr(mod, "__file__", None)

        print(f"Flow filepath: {flow_filepath}")

        deployment = Deployment.build_from_flow(
            flow=workflow_flow,
            name=schedule.id,
            version=1,
            entrypoint=f"{flow_filepath}:{workflow_flow.fn.__name__}",
            work_queue_name="default",
            parameters={},
            schedule=deployment_schedule,

        )
        deployment.apply()
a
Thank you Cole! It works perfectly well for me. I really appreciate it 🙂
🙌 1