-
Notifications
You must be signed in to change notification settings - Fork 683
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
[Core feature] --lables Option for pyflyte register #5162
Comments
Hey @gilbert-stripe, great to see you back with another interesting challenge! 😎 Based on the information you've provided and the context I've found, it seems like you can add labels and annotations to workflows and launch plans during the registration process using the Here's an example of how you can use these options: pyflyte register --k8s-labels '{"mylabel": "myvalue"}' --k8s-annotations '{"myannotation": "myvalue"}' ... Replace Please note, the specific syntax for Additionally, you can add labels and annotations to workflows and launch plans programmatically during the registration process without using command line options. This can be achieved by using the from flytekit import Labels, Annotations
@workflow
class MyWorkflow(object):
...
my_launch_plan = MyWorkflow.create_launch_plan(
labels=Labels({"myexecutionlabel": "bar", ...}),
annotations=Annotations({"region": "SEA", ...}),
...
) I hope this helps! If you have any other questions or need further clarification, feel free to ask. Sources
|
Looked into this a bit, got confused from the various labels and such that exist already in Flyte. For background, There are
Note that there is also a Unrelated, I also wanted to point out there are tags in TaskMetadata and WorkflowMetadata, but these are unrelated and not really exposed through flytekit so best not to use them. Keep in mind also that the "Labels" for execution and launch plan spec do end up in K8s pod labels, so you're limited to those rules (you can't have an _ in the label key at least, label keys have to be <64 characters in length. For purposes of this ticket, it sounds like you're just looking for some way to set labels at registration time. I think this is doable once the work is done to merge tags and Labels together and the API/UI changes are made to be able to search on them, etc. There's currently not a --tags option on pyflyte register, only on pyflyte run, but I think it makes sense to add those. It feels like the right place for those to end up is in the LaunchPlanSpec Labels field. These get merged/override any labels that are manually set on in the LaunchPlan constructor in python code. what do you think @eapolinario ? |
Motivation: Why do you think this is important?
We are the ML infra team for our company and we provide Flyte as a platform to our internal users. As a result, we cannot add labels in the tasks or launch plans since we are not the owner of the workflow code.
However, we hope to add some metadata while registering the workflow, and be used when the workflow runs later.
For example, we want to save the git commit hash when user save their models. So we can retrieve the git commit hash by remote.fetch_launch_plan().get_lables().get("git_commit_hash").
In conclusion, the overall process is:
Goal: What should the final outcome look like, ideally?
pyflyte register supports adding launch labels.
Describe alternatives you've considered
There is no alternatives.
Propose: Link/Inline OR Additional context
No response
Are you sure this issue hasn't been raised already?
Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: