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

[flyin] Use current context logger instead of root logger to show info level logs #1998

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

ByronHsu
Copy link
Collaborator

@ByronHsu ByronHsu commented Nov 27, 2023

Tracking issue

flyteorg/flyte#4284

Why?

Originally, we used the root logger imported from flytekit. However, it doesn't show the info level logs. The default level is a warning.

What?

Switch to use the logger from flytekit current_context, which is used to print logs during execution. By default, it uses user-space logger, whose level is INFO, so it can also print logs >= INFO level.

The usage is simple. We call logger = flytekit.current_context().logging to get the logger.

Test

IMAGE="localhost:30000/flytekit:0.0.4"

@task(
    container_image=IMAGE,
)
@vscode
def t():
    print("123123")
    ...
image

@ByronHsu ByronHsu changed the title Use user_space logger instead of root logger to show info level logs [flyin] Use user_space logger instead of root logger to show info level logs Nov 27, 2023
Copy link

codecov bot commented Nov 27, 2023

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (a6f9991) 85.81% compared to head (454a92a) 85.80%.

Files Patch % Lines
...lyin/flytekitplugins/flyin/vscode_lib/decorator.py 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1998      +/-   ##
==========================================
- Coverage   85.81%   85.80%   -0.02%     
==========================================
  Files         313      313              
  Lines       23299    23304       +5     
  Branches     3530     3530              
==========================================
+ Hits        19995    19996       +1     
- Misses       2701     2705       +4     
  Partials      603      603              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ByronHsu ByronHsu changed the title [flyin] Use user_space logger instead of root logger to show info level logs [flyin] Use current context logger instead of root logger to show info level logs Nov 27, 2023
@Future-Outlier
Copy link
Member

I think it's great!

Copy link
Member

@Future-Outlier Future-Outlier left a comment

Choose a reason for hiding this comment

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

LGTM!

@ByronHsu ByronHsu merged commit 6cace53 into flyteorg:master Nov 27, 2023
74 of 76 checks passed
RRap0so pushed a commit to RRap0so/flytekit that referenced this pull request Dec 15, 2023
…lyteorg#1998)

Signed-off-by: byhsu <byhsu@linkedin.com>
Co-authored-by: byhsu <byhsu@linkedin.com>
Signed-off-by: Rafael Raposo <rafaelraposo@spotify.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants