Hello everyone, I am creating a deployment whit th...
# ask-community
j
Hello everyone, I am creating a deployment whit this code:
Copy code
def build_and_register_flow(schedule_time, flow_name):
    """Build the prefect flow."""
    response = run_deployment(
        name=flow_name,
        scheduled_time=schedule_time,
        idempotency_key=schedule_time.strftime("%Y-%m-%d %H:%M:%S"),
        timeout=0
        )
    print(response)
But I am getting:
Copy code
<coroutine object run_deployment at 0x7fc5082b9f40>
And the deployment is not set. Does anyone know what is going on?
1
n
Hi @Jhonatan Sossa - that’s an async operation so you’ll need to await it; when you say the deployment is not set, what do you mean?
j
I am trying to shedule a deployment run to a specific time and i doesn't work. I tried to add the await to the run_deployment but i got ''await' outside async function'
d
import asyncio asyncio.run(deploymentcodehere)
Another solution is to keep adding async to all the methods up till the call 😄
😛 1
n
Either of those methods would work @Jhonatan Sossa - if your run isn’t showing up in the UI it’s possible you’re passing the name or schedule incorrectly, which the
response
should let you know
j
Thank you guys
👍 1