Usage¶
Cli¶
Run the command line prefect-yaml with the specified configuration
file.
For example, the following YAML configuration is located in examples/simple_config.yaml.
metadata:
output:
directory: .output
task:
task_a:
caller: math:fabs
parameters:
- -9.0
output:
format: json
task_b:
caller: math:sqrt
parameters:
- !data task_a
output:
directory: null
task_c:
caller: math:fsum
parameters:
- [!data task_b, 1]
Run the following command to generate all the task outputs to the
directory .output in the running directory.
prefect-yaml -c examples/simple_config.yaml
The output directory contains all the task outputs in the specified format.
% tree .output
.output
├── task_a.json
└── task_c.pickle
0 directories, 2 files
The expected behavior is to
run
task_ato dump the valuefabs(-9.0)to the output directory in JSON format,run
task_bto get the valuesqrt(9.0)(from the output oftask_a)run
task_cto dump the valuefsum([3.0, 1.0])to the output directory in pickle format.
As the output directory in task_b is overridden as null, the output of task_b is passed to task_c in memory. Also, the output format in task_c
is not specified so it is dumped in default format (pickle).
For further details, please see the section configuration in the documentation.
Prefect Deployment¶
It also supports running the flow via prefect deployment.
First build the deployment configuration via command
prefect deployment build prefect_yaml.deployment:prefect_yaml_flow -n prefect_yaml_flow -q regular -i process
Then apply the prefect deployment with its deployment configuration. For example, the above command exports the configuration in default name prefect_yaml_flow-deployment.yaml
prefect deployment apply prefect_yaml_flow-deployment.yaml
For further information about deployment YAML, please refer to prefect official page.