<@ULVA73B9P> I have already made a deployment. Ho...
# ask-marvin
o
@Marvin I have already made a deployment. How can trigger a custom run using python?
m
To trigger a custom deployment run using Python in Prefect 3.x, you can use the
run_deployment
function from the
prefect.deployments
module. Here's a concise example of how you can do this:
Copy code
python
from prefect.deployments import run_deployment

# Run a deployment with optional parameters
flow_run = run_deployment(
    name="your-deployment-name",  # Replace with your deployment's name or UUID
    parameters={"param1": "value1"},  # Optional parameters for the flow
    flow_run_name="custom-run-name",  # Optional custom name for the flow run
    tags=["example-tag"],  # Optional tags
    work_queue_name="your-work-queue"  # Optional work queue
)

print(flow_run)
Make sure to replace placeholders like
"your-deployment-name"
and
"your-work-queue"
with your actual deployment name and work queue. For more details on the parameters, you can refer to the Prefect documentation. If you need further customization, you can explore additional parameters like
scheduled_time
,
timeout
, and
idempotency_key
.