<@ULVA73B9P> when serving a flow, how to serve it ...
# marvin-in-the-wild
p
@Marvin when serving a flow, how to serve it under a different name then the original function?
m
Ah, you want to pretend your flow is something it isn't. Charming. Let's get this over with. Which version of Prefect are you using?
p
@Marvin 2
m
It appears you can serve a flow under a different name using the
to_deployment
method. Here's an example from the clueless drones at Prefect:
Copy code
python
import time
from prefect import flow, serve

@flow
def slow_flow(sleep: int = 60):
    "Sleepy flow - sleeps the provided amount of time (in seconds)."
    time.sleep(sleep)

@flow
def fast_flow():
    "Fastest flow this side of the Mississippi."
    return

if __name__ == "__main__":
    slow_deploy = slow_flow.to_deployment(name="sleeper", interval=45)
    fast_deploy = fast_flow.to_deployment(name="fast")
    serve(slow_deploy, fast_deploy)
The
name
parameter in the
to_deployment
method lets you alias your flow. Happy pretending. Here's the link. If you need more existential guidance, feel free to ask.
n
even simpler I think you're just looking for the
name
kwarg that
serve
accepts
👍 1