-
Notifications
You must be signed in to change notification settings - Fork 333
[Feat] Enable registered entity summary output and quiet flag in pyflyte register #3028
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
f51be71
104783e
9bba92f
f1be205
db9f744
a3734e4
42510ba
8a82a78
05ab275
386eea0
4b2b3b9
cf16cb4
43704b8
4068ad0
dc490a5
5fcf464
aad07e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,12 +1,14 @@ | ||||||||||||||||||||||||||||||||
import asyncio | ||||||||||||||||||||||||||||||||
import functools | ||||||||||||||||||||||||||||||||
import json | ||||||||||||||||||||||||||||||||
import os | ||||||||||||||||||||||||||||||||
import tarfile | ||||||||||||||||||||||||||||||||
import tempfile | ||||||||||||||||||||||||||||||||
import typing | ||||||||||||||||||||||||||||||||
from pathlib import Path | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
import click | ||||||||||||||||||||||||||||||||
import yaml | ||||||||||||||||||||||||||||||||
from rich import print as rprint | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
from flytekit.configuration import FastSerializationSettings, ImageConfig, SerializationSettings | ||||||||||||||||||||||||||||||||
|
@@ -251,6 +253,8 @@ def register( | |||||||||||||||||||||||||||||||
remote: FlyteRemote, | ||||||||||||||||||||||||||||||||
copy_style: CopyFileDetection, | ||||||||||||||||||||||||||||||||
env: typing.Optional[typing.Dict[str, str]], | ||||||||||||||||||||||||||||||||
summary_format: typing.Optional[str], | ||||||||||||||||||||||||||||||||
summary_dir: typing.Optional[str], | ||||||||||||||||||||||||||||||||
dry_run: bool = False, | ||||||||||||||||||||||||||||||||
activate_launchplans: bool = False, | ||||||||||||||||||||||||||||||||
skip_errors: bool = False, | ||||||||||||||||||||||||||||||||
|
@@ -333,6 +337,14 @@ def _raw_register(cp_entity: FlyteControlPlaneEntity): | |||||||||||||||||||||||||||||||
is_lp = True | ||||||||||||||||||||||||||||||||
else: | ||||||||||||||||||||||||||||||||
og_id = cp_entity.template.id | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
result = { | ||||||||||||||||||||||||||||||||
"id": og_id.name, | ||||||||||||||||||||||||||||||||
"type": og_id.resource_type_name(), | ||||||||||||||||||||||||||||||||
"version": og_id.version, | ||||||||||||||||||||||||||||||||
"status": "skipped", # default status | ||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||
|
result = { | |
"id": og_id.name, | |
"type": og_id.resource_type_name(), | |
"version": og_id.version, | |
"status": "skipped", # default status | |
} | |
result = { | |
"id": og_id.name, | |
"type": og_id.resource_type_name(), | |
"version": og_id.version, | |
"status": "skipped", # default status | |
"timestamp": datetime.datetime.now().isoformat(), | |
"error_message": "", | |
"details": {} | |
} |
Code Review Run #9a3edb
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it fails, what will the values of other keys be?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The values of the other keys(id, type, version) are pre-computed before registration. Thus, the values will not be empty even if the registration fails.
The values are from:
result = {
"id": og_id.name,
"type": og_id.resource_type_name(),
"version": og_id.version,
"status": "skipped", # default status
}
where og_id is the id of the entity's template / entity itself.
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using a set for supported_format
instead of a list since we're only checking membership. This would provide O(1) lookup instead of O(n). Could be defined as supported_format = {'json', 'yaml'}
.
Code suggestion
Check the AI-generated fix before applying
supported_format = ["json", "yaml"] | |
if summary_format not in supported_format: | |
raise ValueError(f"Unsupported file format: {summary_format}") | |
if summary_format not in {"json", "yaml"}: | |
raise ValueError(f"Unsupported file format: {summary_format}") |
Code Review Run #9a3edb
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that the other registration may overwrite the summary? I think we could name the file with other unique names (ie. tmp file, py file name, wf name, version number)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! The summary will be overwritten if the registration is rerun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding validation for
summary-format
andsummary-dir
options. Whensummary-format
is specified butsummary-dir
is not, the summary may not be saved correctly. Consider makingsummary-dir
required whensummary-format
is provided.Code suggestion
Code Review Run #9a3edb
Is this a valid issue, or was it incorrectly flagged by the Agent?