Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add display_name field to graphs endpoint #8287

Closed
wants to merge 1 commit into from

Conversation

brandonreid
Copy link
Contributor

Resolves PrefectHQ/graphs/issues/55

This PR adds a display_name field to the graphs endpoint, so that on the Flow Run Timeline, we can show the task name in a more human readable way, without the unique id's that make the name super long:

image

See `display_name` compared to `name`.

This was achieved by grabbing the end of the task_key, which consistently uses the original task name (either the default, or user specified one) at the end, according to a scanning of the latest 1000 records in staging.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • This pull request includes tests or only affects documentation.
  • This pull request includes a label categorizing the change e.g. fix, feature, enhancement

@brandonreid brandonreid requested review from a team and zangell44 as code owners January 27, 2023 16:03
@netlify
Copy link

netlify bot commented Jan 27, 2023

Deploy Preview for prefect-orion ready!

Name Link
🔨 Latest commit 88b7d42
🔍 Latest deploy log https://app.netlify.com/sites/prefect-orion/deploys/63d421d18b3085000b7edbcb
😎 Deploy Preview https://deploy-preview-8287--prefect-orion.netlify.app/api-ref/orion/models/flow_runs
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@brandonreid brandonreid added the enhancement An improvement of an existing feature label Jan 27, 2023
@brandonreid brandonreid changed the title enhancement: add display_name field to graphs endpoint add display_name field to graphs endpoint Jan 27, 2023
@brandonreid brandonreid force-pushed the add-display-name-field-to-graphs branch from bc9b71e to 88b7d42 Compare January 27, 2023 19:11
@@ -351,6 +352,7 @@ async def read_task_run_dependencies(
"state": task_run.state,
"expected_start_time": task_run.expected_start_time,
"name": task_run.name,
"display_name": task_run.task_key.rpartition(".")[-1],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we partition on a period?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if anything, I think the display name should be a portion of the task run name not the task key?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task_key is delimited by a ., in instances where there is no period, like when a user has defined a key manually, rpartition will still result in an array where the last value is the whole word.

Copy link
Contributor

@zanieb zanieb Jan 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. The task_key defaults to the qualified import name of the task, a right-partition on a period does make sense here. However, the task key doesn't really make sense as the display name for a task run since task runs won't be distinguishable? A right partition of the task_key is also the same as the default value for the task name so if you are just trying to show task names you should probably use that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. If there are more than one instance of a task run in a flow, it will show up twice with the same name, but the intent is for the UI to surface the unique name on click. The unique string at the end is not very human readable on it's own and clutters charts, making it more harmful than helpful when simply fallowing the series of events.

You can see that demonstrated here:
https://user-images.githubusercontent.com/6776415/215178374-c839420b-5bbd-461b-9501-2a602846e9e9.mov

The individual task run name will be available when exploring the task details.

Copy link
Contributor

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be weird once we start letting users define their own names.

Can you add test coverage for this?

@brandonreid
Copy link
Contributor Author

Closing this as we explore ways of making the task_run name itself be somewhat simplified and more future proofed for when the user is able to create their own name values.

@brandonreid brandonreid deleted the add-display-name-field-to-graphs branch April 24, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement of an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use human readable task names
3 participants