Open nspcc-cm opened 3 weeks ago
Thanks for the issue @nspcc-cm!
I'd expect the name used in the flow decorator to be shown in the UI, so this may actually be a bug. Can you share some details about how you're deploying this flow? I think relevant details would be whether you're using the CLI or flow.deploy
and an example of your configuration. My hunch is there's a bug somewhere in the deployment creation logic in the client.
No problem, @desertaxle
I'm deploying using the CLI (prefect deploy -n "shopify-extract-products"
) and here's a snippet from the prefect.yaml:
deployments:
# ...other deployment configs here...
- name: shopify-extract-products
version: null
tags: []
description: null
entrypoint: src/extract.py:extract_products
parameters: {}
work_pool:
name: local
work_queue_name: null
job_variables: {}
schedules:
- cron: "0 7 * * *"
I haven't been able to recreate yet with .serve
or prefect deploy
; @nspcc-cm could you try to come up with a minimal reproducible example that we can run on our machines to recreate the issue?
Describe the current behavior
If you deploy a flow, the 'Flow Name' used on the Deployments UI page is the name of the decorated function, rather than the flow's name from the @flow(name="xyz") decoration.
Code:
Prefect Deployments UI:
Describe the proposed behavior
The value in the Flow Name column of the UI Deployments page should be the name given to the
@flow
decoration, falling back to the function name when a name isn't supplied.Example Use
With this change, if I'm integrating Prefect into existing scripts I don't have to refactor function names to be Prefect-friendly in the UI.
Without this change, if my current suite of ETL scripts each have a
main()
entrypoint, all of the flow names on my Deployments UI page are going to read as "main" unless I refactor them.With this change, my
@flow
name parameter can help me understand what the flow is doing, without making any changes within existing functions.Additional context
This is less of a concern if you use Prefect from the start of a project. But if you're trying to integrate Prefect into existing flows, changing function names so they are UI friendly can be a less-than-inconsequential set of steps to take.