Mark Weiss
07/03/2024, 2:42 AMMarvin
07/03/2024, 2:43 AMTyper or argparse for local execution. For configuring deployments, you typically use YAML.
Here's an example of using argparse for local execution:
python
from prefect import flow
from argparse import ArgumentParser
@flow
def my_flow(argument1, argument2):
print(f"Argument 1: {argument1}, Argument 2: {argument2}")
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("--argument1", required=True, help="First argument")
parser.add_argument("--argument2", required=True, help="Second argument")
args = parser.parse_args()
my_flow(args.argument1, args.argument2)
For configuring deployments, you use a prefect.yaml file. Example:
yaml
deployments:
- name: my_deployment
entrypoint: my_module:my_flow
parameters:
argument1: default_value1
argument2: default_value2
For more detailed guidance, refer to Prefect documentation. Remember that deploying with prefect deploy requires the --all flag to include all deployment specifications from your prefect.yaml.
Consider the provided example for basic use cases.
If you run into specific issues or errors, checking GitHub Issues is also a helpful resource.