David
03/06/2025, 7:13 PMdeploy_flows:
runs-on: ubuntu-latest
name: DEPLOY
needs: [build_deploy_and_terraform, setup]
if: ${{ needs.setup.outputs.flows_changed == 'true' }}
strategy:
matrix:
flows: ${{ fromJson(needs.setup.outputs.prefect_flows) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Deploy flows
id: flow-time
run: |
pip install --upgrade pip
pip install prefect
prefect config set PREFECT_API_KEY=${{ secrets.PREFECT_API_KEY }}
prefect config set PREFECT_API_URL=${{ secrets.PREFECT_API_URL }}
FLOW_NAME=$(basename ${{ matrix.flows }} .py)
prefect deploy -n ${{ env.POOL }}-base-deployment -t ${{ env.POOL }} -p ecs-${{env.POOL}}-pool ${{ matrix.flows }}:$FLOW_NAME
echo "flow_manifest=$FLOW_NAME.yaml" >> $GITHUB_ENV
but my pydantic params are not populating the ui, how do i fix that?Marvin
03/06/2025, 7:13 PMParameterTypeError
. Ensure that your Pydantic models are consistent in version and properly defined.
2. UI Display: Parameters should be defined in a way that Prefect can interpret and display them in the UI. Ensure that your parameters are correctly specified in your flow and deployment configurations.
3. Documentation: Review the Prefect 3.x documentation on writing flows to ensure you're following the best practices for parameter definition and usage.
4. Code Integration: Make sure your CI script correctly installs and deploys the flows with the necessary configurations. The script you've provided seems to set API keys and URLs correctly, but double-check that your flows
matrix and environment variables are correctly set up and that the flows themselves are correctly defined to include Pydantic parameters.
If these suggestions don't resolve your issue, consider checking for any specific errors related to Pydantic validation in your logs or reaching out to the Prefect community for more specific guidance.David
03/07/2025, 12:30 PMMarvin
03/07/2025, 12:31 PMprefect.yaml
file. To address this, you'll need to ensure that your deployment names in the prefect.yaml
file match those used in your deployment commands.
Here's how you can align your prefect.yaml
file and reference Pydantic parameters:
1. Deployment Names: Ensure that the deployment name in your prefect.yaml
matches the name you use in your CI script. This will prevent the creation of new deployments unnecessarily.
2. Referencing Pydantic Parameters: While the documentation doesn't explicitly mention Pydantic parameters in the prefect.yaml
, you can define parameters in the flow and reference them in the deployment configuration. This typically involves setting up parameters in your flow function and ensuring they are passed correctly during deployment.
3. Example of prefect.yaml
:
yaml
deployments:
- name: XXXX-base-deployment
entrypoint: path/to/your_flow.py:your_flow_function
parameters:
my_param: "{{ pydantic_parameter }}"
4. Environment Variables: You can use environment variables in your prefect.yaml
like {{ $MY_ENV_VAR }}
to dynamically populate values, which can be particularly useful for sensitive or environment-specific parameters.
For more detailed guidance, refer to the Prefect documentation on `prefect.yaml`.
Ensure that your flow function is correctly set up to accept and use these parameters, and that your CI/CD pipeline is configured to pass them correctly. If issues persist, checking logs for parameter validation errors might provide additional insights.David
03/07/2025, 5:14 PMSet 'PREFECT_API_URL' to
'<https://api.prefect.cloud/api/accounts/><redacted>/wor
kspaces/aa6687fe-c293-42cf-b532-f064bdb060d8'.
PREFECT_API_URL is also set by an environment variable which will override your
config value. Run `unset PREFECT_API_URL` to clear it.
Updated profile 'ephemeral'.
The following deployment(s) could not be found and will not be deployed:
shep-base-deployment
Could not find any deployment configurations with the given name(s):
shep-base-deployment. Your flow will be deployed with a new deployment
configuration.
Marvin
03/07/2025, 5:14 PMPREFECT_API_URL
.
- Profiles are stored in a profiles.toml
file, usually located at ~/.prefect/profiles.toml
. You might want to create or switch to a more permanent profile for your deployments.
2. Environment Variables:
- The PREFECT_API_URL
environment variable is overriding the configuration set in your profile. This is expected behavior if the environment variable is set in your CI environment or elsewhere.
- Ensure that your environment variables are correctly set and not conflicting with your intended profile settings.
3. Deployment Configuration:
- The message about the deployment not being found suggests that the deployment name in your CI script doesn't match any existing deployment configurations. Ensure that your prefect.yaml
file (or the equivalent deployment configuration) aligns with the names used in your CI/CD scripts.
For more details on managing profiles and configurations, refer to the Prefect documentation on settings and profiles. You may need to create a specific profile with the desired settings and switch to it using the Prefect CLI commands.Marvin
03/07/2025, 5:14 PMPREFECT_API_URL
.
2. Environment Variable Override:
- The PREFECT_API_URL
is being set by an environment variable, which takes precedence over any profile configuration. This is standard behavior, as environment variables are meant to provide dynamic configuration, especially useful in CI/CD environments.
3. Deployment Configuration:
- The message about the deployment not being found indicates that the deployment name specified in your script or configuration doesn't match any existing deployment configurations. This could be due to a mismatch in naming or missing configuration in your prefect.yaml
.
To address this:
- Create a Permanent Profile: Consider creating a permanent profile with all necessary configurations and switch to it using Prefect CLI commands. This can help maintain consistency across environments.
- Check Environment Variables: Ensure that your environment variables are set correctly and are not inadvertently overriding desired configurations.
- Align Deployment Configurations: Make sure your deployment names and configurations in your prefect.yaml
file match those used in your scripts.
For more on managing profiles, refer to the Prefect documentation on settings and profiles.David
03/11/2025, 4:17 PMSet 'PREFECT_API_KEY' to '***'.
PREFECT_API_KEY is also set by an environment variable which will override your
config value. Run `unset PREFECT_API_KEY` to clear it.
Updated profile 'ephemeral'.
Set 'PREFECT_API_URL' to
'<https://api.prefect.cloud/api/accounts/9484c9ef-9449-4ba7-9229-1390f50e8794/wor>
kspaces/XXX'.
PREFECT_API_URL is also set by an environment variable which will override your
config value. Run `unset PREFECT_API_URL` to clear it.
Updated profile 'ephemeral'.
The following deployment(s) could not be found and will not be deployed:
terminal_playback_report-base
Could not find any deployment configurations with the given name(s):
terminal_playback_report-base. Your flow will be deployed with a new deployment
configuration.
╭──────────────────────────────────────────────────────────────────────────────╮
│ Deployment 'terminal_playback_report/terminal_playback_report-base' │
│ successfully created with id 'XXX'. │
╰──────────────────────────────────────────────────────────────────────────────╯
View Deployment in UI: XXX
To schedule a run for this deployment, use the following command:
$ prefect deployment run
'terminal_playback_report/terminal_playback_report-base'
Marvin
03/11/2025, 4:18 PMPREFECT_API_KEY
and PREFECT_API_URL
are set via environment variables. Ensure these are correctly set in your GitHub workflow environment. Incorrect settings can lead to issues with deployment configurations.
2. Deployment Configuration: The logs mention that the deployment configuration terminal_playback_report-base
couldn't be found. This might mean your deployment YAML is not correctly set or is missing. Ensure that your deployment configuration is properly defined in your Prefect YAML file.
3. Pydantic Parameters: There is a known issue where Prefect's UI may not display Pydantic parameters correctly. This might be a UI issue rather than a deployment issue. You can verify if the parameters are actually missing by checking the deployment's parameter schema in your Prefect Cloud dashboard.
4. Documentation and Examples: You can refer to the Prefect documentation for setting up environment variables and profiles. Additionally, here's a GitHub example for validating deployment configurations.
5. GitHub Issues: If this is a persistent issue, consider checking related GitHub issues such as Prefect Cloud UI parameters missing type hints which might provide additional context or workarounds.
If the issue persists, you might want to create a minimal reproducible example and seek further assistance from the Prefect community or their support.David
03/11/2025, 4:56 PMMarvin
03/11/2025, 4:57 PMflow_one
and flow_two
, you can create deployments with names like flow_one-deployment
and flow_two-deployment
.
- Using Prefect YAML: In your prefect.yaml
file, each deployment declaration should have a unique name field. You can deploy multiple deployments by specifying their names or using patterns to match multiple deployment names.
For more details, you can refer to the Prefect documentation on deployment naming.
Here's an example of deploying multiple flows with unique deployment names:
python
from prefect import flow, deploy
@flow
def flow_one():
pass
@flow
def flow_two():
pass
if __name__ == "__main__":
deploy(
*[
f.to_deployment(
name=f"{f.name}-deployment",
)
for f in [flow_one, flow_two]
]
)
This ensures that each deployment is uniquely named and avoids conflicts.