-
Notifications
You must be signed in to change notification settings - Fork 307
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
Tracks progress for package creation, upload and kickoff #2935
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Ketan Umare <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2935 +/- ##
===========================================
+ Coverage 76.33% 93.26% +16.93%
===========================================
Files 199 48 -151
Lines 20840 1842 -18998
Branches 2681 0 -2681
===========================================
- Hits 15908 1718 -14190
+ Misses 4214 124 -4090
+ Partials 718 0 -718 ☔ View full report in Codecov by Sentry. |
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.
I think we could consider implementing a global Progress
to:
- Simplify the codebase
- Enable consistent progress reporting behavior across modules
- Make it easier to add progress tracking to new modules
- Allow for a global flag to enable/disable all progress logging (especially if we want something like
--verbose
or--silence
)
flytekit/remote/remote.py
Outdated
f"Request to send data {upload_location.signed_url} failed.\nResponse: {rsp.text}", | ||
from rich.progress import Progress, TextColumn, TimeElapsedColumn | ||
|
||
progress = Progress( |
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.
Progress
also has a start method, which is supposed to be invoked explicitly if the Progress
object is not used as a context manager (as mentioned by the author here).
We can use this to make the progress bar customizable.
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.
@eapolinario progress is used as a context manager. look at like 1074
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.
Yeah, I understand, but it doesn't have to be used as a context manager, right? If start
is not called the progress bars don't show up.
Signed-off-by: Ketan Umare <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
Signed-off-by: Jan Fiedler <[email protected]>
a6cc2ed
to
ae55489
Compare
Signed-off-by: Jan Fiedler <[email protected]>
fast-register.movChanges I made:
|
Code Review Agent Run #941fb7Actionable Suggestions - 5
Additional Suggestions - 2
Review Details
|
Changelist by BitoThis pull request implements the following key changes.
|
def fetch_task( | ||
self, | ||
project: str = None, | ||
domain: str = None, | ||
name: str = None, | ||
version: str = None, | ||
) -> FlyteTask: |
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 dataclass or named tuple for the parameters since they are used together in multiple places in the codebase (e.g., fetch_task_lazy
, execute_local_task
, sync_execution
). This could improve code maintainability and reduce parameter duplication.
Code suggestion
Check the AI-generated fix before applying
# Add TaskIdentifier class
@dataclass
class TaskIdentifier:
project: Optional[str] = None
domain: Optional[str] = None
name: Optional[str] = None
version: Optional[str] = None
# Update method signature
def fetch_task(self, task_id: TaskIdentifier = None) -> FlyteTask:
Code Review Run #941fb7
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
self, | ||
project: str = None, | ||
domain: str = None, | ||
name: str = None, | ||
version: str = None, |
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 dataclass or named tuple for the parameters since they are all optional string parameters that appear to be used together frequently.
Code suggestion
Check the AI-generated fix before applying
self, | |
project: str = None, | |
domain: str = None, | |
name: str = None, | |
version: str = None, | |
self, entity_id: EntityIdentifier = None, |
Code Review Run #941fb7
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
upload_package_progress = Progress(TimeElapsedColumn(), TextColumn("[progress.description]{task.description}")) | ||
t1 = upload_package_progress.add_task(f"Uploading package of size {content_length/1024/1024:.2f} MBs", total=1) | ||
|
||
upload_package_progress.start_task(t1) | ||
|
||
if is_display_progress_enabled(): | ||
upload_package_progress.start() |
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 consolidating the progress bar initialization and start logic. Currently there are two separate calls - start_task()
and start()
with a conditional check in between, which could be simplified.
Code suggestion
Check the AI-generated fix before applying
- t1 = upload_package_progress.add_task(f"Uploading package of size {content_length/1024/1024:.2f} MBs", total=1)
- upload_package_progress.start_task(t1)
- if is_display_progress_enabled():
- upload_package_progress.start()
+ if is_display_progress_enabled():
+ t1 = upload_package_progress.add_task(f"Uploading package of size {content_length/1024/1024:.2f} MBs", total=1)
+ upload_package_progress.start()
Code Review Run #941fb7
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
l = len(ls) | ||
t = 0 |
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 more descriptive variable names instead of single letter variables l
and t
. Perhaps total_files
and files_processed
would be more meaningful.
Code suggestion
Check the AI-generated fix before applying
l = len(ls) | |
t = 0 | |
total_files = len(ls) | |
files_processed = 0 |
Code Review Run #941fb7
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
@@ -186,5 +187,9 @@ def get_level_from_cli_verbosity(verbosity: int) -> int: | |||
return logging.DEBUG | |||
|
|||
|
|||
def is_display_progress_enabled() -> bool: | |||
return os.getenv(FLYTEKIT_DISPLAY_PROGRESS_ENV_VAR, False) |
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 os.getenv()
call for FLYTEKIT_DISPLAY_PROGRESS_ENV_VAR
should specify the type for the default value as str
to match environment variable type. Consider using os.getenv(FLYTEKIT_DISPLAY_PROGRESS_ENV_VAR, 'false').lower() == 'true'
for proper boolean conversion.
Code suggestion
Check the AI-generated fix before applying
return os.getenv(FLYTEKIT_DISPLAY_PROGRESS_ENV_VAR, False) | |
return os.getenv(FLYTEKIT_DISPLAY_PROGRESS_ENV_VAR, 'false').lower() == 'true' |
Code Review Run #941fb7
Is this a valid issue, or was it incorrectly flagged by the Agent?
- it was incorrectly flagged
Allows users to understand through visualization if large packages are being uploaded or incorrect files are being packaged.
Summary by Bito
This PR implements progress tracking capabilities in Flytekit, adding visual feedback for package uploads and operations through a new environment variable 'FLYTE_SDK_DISPLAY_PROGRESS'. The changes include package creation and compression progress visualization, along with code formatting improvements for better maintainability.Unit tests added: False
Estimated effort to review (1-5, lower is better): 4