Nimesh Kumar
02/06/2023, 4:11 PMfrom prefect.deployments import Deployment
import requests
deploy = Deployment.build_from_flow(flow=start_inferencing, name="api deployment", work_queue_name="testing")
id_ = deploy.apply()
print("This is Deployment ID", id_)
def create_flow_run(deployment_id: str, base_url="<http://IP:4200/api>"):
print(f"{base_url}/deployments/{deployment_id}/create_flow_run")
return <http://requests.post|requests.post>(
url=f"{base_url}/deployments/{deployment_id}/create_flow_run",
json={
"name": "trigger using api",
"state": {"type": "SCHEDULED"},
"parameters": {"my_param": "bef5f437-49b7-43ec-aac8-a8b4747cb67b", "file_path": "root/flows/tmp_folder"},
},
)
r = create_flow_run(id_)
print(r.status_code)
print(r.text)
When i try to open base url i.e. http://IP:4200 it open but this code throws me a error saying deployment not found, but i guess the whole point of this code is to create a deployment and then run the flow.
404
{"detail":"Deployment not found"}
can anyone please help, what i am doing wrong.