Diego
01/29/2025, 12:53 PMpull:
# required see <https://github.com/PrefectHQ/prefect/issues/10285>
- prefect.deployments.steps.set_working_directory:
directory: /opt/prefect
is added to the prefect.yaml. I was wondering if this can also be done within a .deploy() within a python fileMarvin
01/29/2025, 12:53 PM.deploy()
method is not explicitly documented. However, you can configure deployment options programmatically, which might allow you to set the working directory indirectly.
Here's a general approach you might consider, assuming you're using Prefect 3.x:
1. Define Deployment Programmatically: You can create a deployment object in Python using the Prefect API. While the specific method to set the working directory isn't clear from the documentation, you can define other deployment parameters programmatically.
2. Using Prefect YAML: The issue you mentioned involves setting the working directory in the prefect.yaml
file. This is a more straightforward approach and is well-documented. You can include a step like prefect.deployments.steps.set_working_directory
in the YAML configuration.
For more detailed guidance, you might want to explore the Prefect documentation on deployment customization or check the GitHub discussions related to working directory issues.
If you find that setting the working directory programmatically is necessary and not well-supported, you might consider contributing to the Prefect GitHub discussions or requesting this feature.
For now, if using the YAML configuration is feasible, it might be the most reliable approach until more explicit support is added to the Python API.