https://prefect.io logo
Title
a

Ax

01/05/2023, 11:20 PM
How to run a flow on Prefect cloud with curl?
We managed to come here:
def create_flow_run(
    deployment_id: str,
    base_url="<https://api.prefect.cloud/api/accounts/acc/workspaceswss3>",
):
    return <http://requests.post|requests.post>(
        url=f"{base_url}/deployments/{deployment_id}/create_flow_run",
        json={"name": "your_flow_runxX", "state": {"type": "SCHEDULED"}, "parameters":{"name": "marjan"}},
        headers={
            "Content-Type": "application/json",
            "Authorization": f"Bearer {API_KEY}",
        },
    )


if __name__ == "__main__":
    r = create_flow_run("deployment")
    print(r.status_code)
    print(r.text)
How to make it run immediately without triggering the agents?
k

Kalise Richmond

01/06/2023, 1:33 AM
Hi @Ax, If you want to trigger a deployment without running an agent, you can execute using Prefect client api, however if you want the deployment to schedule flowruns, you will need an agent to pull scheduled work from a work queue.
a

Ax

01/09/2023, 1:47 PM
Thanks @Kalise Richmond. What’s the fastest way to deploy agents in the cloud without needing to set up the Kubernetes? We would like to get Prefect running without investing too much effort into the infrastructure configuration
1
a

Anna Geller

01/09/2023, 1:57 PM
check out my GitHub, e.g. for AWS this and for GCP this - both as serverless as possible
🙌 2
r

Ryan Peden

01/09/2023, 5:13 PM
And if you're open to using Azure, I wrote a post about how to spin up a Prefect agent using Azure Container Instances. No infra config required. You just need to create a resource group and after that, deploying an agent only requires a single CLI command.
🙌 1