-
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
Open
paullongtan
wants to merge
17
commits into
flyteorg:master
Choose a base branch
from
paullongtan:feat/add_register_output_format
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f51be71
feat: add options to output registered entity summary
paullongtan 104783e
refactor: do registrated summary format checking earlier
paullongtan 9bba92f
fix: fix unit test
paullongtan f1be205
chore: code clean up
paullongtan db9f744
test: add yaml output format and registration without specifying --su…
paullongtan a3734e4
feat: add quiet flag to mute cli outputs and change registration summ…
paullongtan 42510ba
fix: restore original secho after register quiet usage
paullongtan 8a82a78
refactor: add json and yaml parse error handling
paullongtan 05ab275
fix: set logger level when using quiet flag
paullongtan 386eea0
fix: comment out logs from pyflyte to ensure registration summary out…
paullongtan 4b2b3b9
chore: lint
paullongtan cf16cb4
refactor: enable config and pkg related debug log when verbose > 0
paullongtan 43704b8
fix: import flytekit configs
paullongtan 4068ad0
Merge remote-tracking branch 'upstream/master' into feat/add_register…
paullongtan dc490a5
Merge remote-tracking branch 'upstream/master' into feat/add_register…
paullongtan 5fcf464
merge upstream
paullongtan aad07e8
Merge branch 'upstream-master' into feat/add_register_output_format
paullongtan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from flytekit.image_spec.image_spec import ImageSpec, ImageSpecBuilder | ||
|
||
|
||
class NoOpBuilder(ImageSpecBuilder): | ||
"""Noop image builder.""" | ||
|
||
builder_type = "noop" | ||
|
||
def should_build(self, image_spec: ImageSpec) -> bool: | ||
""" | ||
The build_image function of NoOpBuilder does not actually build a Docker image. | ||
Since no Docker build process occurs, we do not need to check for Docker daemon | ||
or existing images. Therefore, should_build should always return True. | ||
|
||
Args: | ||
image_spec (ImageSpec): Image specification | ||
|
||
Returns: | ||
bool: Always returns True | ||
""" | ||
return True | ||
|
||
def build_image(self, image_spec: ImageSpec) -> str: | ||
if not isinstance(image_spec.base_image, str): | ||
msg = "base_image must be a string to use the noop image builder" | ||
raise ValueError(msg) | ||
|
||
import click | ||
|
||
click.secho(f"Using image: {image_spec.base_image}", fg="blue") | ||
return image_spec.base_image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from flyteidl.admin import launch_plan_pb2 as _launch_plan_idl | ||
|
||
from flytekit.models import common as _common | ||
|
||
|
||
class ConcurrencyLimitBehavior(object): | ||
SKIP = _launch_plan_idl.CONCURRENCY_LIMIT_BEHAVIOR_SKIP | ||
|
||
@classmethod | ||
def enum_to_string(cls, val): | ||
""" | ||
:param int val: | ||
:rtype: Text | ||
""" | ||
if val == cls.SKIP: | ||
return "SKIP" | ||
else: | ||
return "<UNKNOWN>" | ||
|
||
|
||
class ConcurrencyPolicy(_common.FlyteIdlEntity): | ||
""" | ||
Defines the concurrency policy for a launch plan. | ||
""" | ||
|
||
def __init__(self, max_concurrency: int, behavior: ConcurrencyLimitBehavior = None): | ||
self._max_concurrency = max_concurrency | ||
self._behavior = behavior if behavior is not None else ConcurrencyLimitBehavior.SKIP | ||
|
||
@property | ||
def max_concurrency(self) -> int: | ||
""" | ||
Maximum number of concurrent workflows allowed. | ||
""" | ||
return self._max_concurrency | ||
|
||
@property | ||
def behavior(self) -> ConcurrencyLimitBehavior: | ||
""" | ||
Policy behavior when concurrency limit is reached. | ||
""" | ||
return self._behavior | ||
|
||
def to_flyte_idl(self) -> _launch_plan_idl.ConcurrencyPolicy: | ||
""" | ||
:rtype: flyteidl.admin.launch_plan_pb2.ConcurrencyPolicy | ||
""" | ||
return _launch_plan_idl.ConcurrencyPolicy( | ||
max=self.max_concurrency, | ||
behavior=self.behavior, | ||
) | ||
|
||
@classmethod | ||
def from_flyte_idl(cls, pb2_object: _launch_plan_idl.ConcurrencyPolicy) -> "ConcurrencyPolicy": | ||
""" | ||
:param flyteidl.admin.launch_plan_pb2.ConcurrencyPolicy pb2_object: | ||
:rtype: ConcurrencyPolicy | ||
""" | ||
return cls( | ||
max_concurrency=pb2_object.max, | ||
behavior=pb2_object.behavior, | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 context manager to handle logger level changes instead of storing the level in a global variable. This would ensure proper cleanup and avoid potential side effects. A similar issue was also found in flytekit/tools/repo.py (line 290).
Code suggestion
Code Review Run #7297c4
Is this a valid issue, or was it incorrectly flagged by the Agent?