Vinicius Silva
01/15/2025, 4:22 PMMarvin
01/15/2025, 4:22 PM@flow
decorator to define your flow and specify any parameters it requires. Prefect will handle prompting for these parameters when you trigger the flow.
python
from prefect import flow
@flow
def my_flow(param: str):
print(f"Received parameter: {param}")
2. Configure prefect.yaml
: In your prefect.yaml
file, specify the deployment without a schedule. Prefect allows you to define triggers in the prefect.yaml
, but since you want to trigger manually, you won't set any triggers or schedules.
yaml
deployments:
- name: my-manual-deployment
flow: my_flow
parameters:
param: null # This will prompt for the parameter when triggered
3. Deploy the Flow: Use the CLI to deploy the flow with the specified configuration.
bash
prefect deploy -n my-manual-deployment
4. Trigger the Flow Manually: You can run the deployment manually from the Prefect UI or CLI. Prefect will prompt for the param
value when you trigger the flow.
For more detailed guidance, refer to the Prefect documentation.
This approach ensures that the flow is only run when manually triggered, and it will prompt for any required parameters at runtime.Vinicius Silva
01/15/2025, 4:23 PMMarvin
01/15/2025, 4:24 PM@flow
decorator to define your flow and specify any parameters it requires.
python
from prefect import flow
@flow
def my_flow(param: str):
print(f"Received parameter: {param}")
2. Configure deployment.yaml
: In Prefect 2.x, you'll use a deployment.yaml
file to specify the deployment. Set the parameters to prompt for them during runtime by leaving them unset or set to null
.
yaml
name: my-manual-deployment
flow_name: my_flow
parameters:
param: null # This will prompt for the parameter when triggered
3. Deploy the Flow: Use the CLI to deploy the flow using the configuration in deployment.yaml
.
bash
prefect deployment create -n my-manual-deployment
4. Trigger the Flow Manually: You can run the deployment manually from the Prefect UI or CLI. When you trigger the flow, Prefect will prompt for the param
value.
For more details, refer to the Prefect 2.x documentation.
This setup will ensure that the flow is only executed manually and prompts for the required parameters when triggered.