Skip to content

Conversation

@bcdurak
Copy link
Contributor

@bcdurak bcdurak commented Apr 1, 2025

Describe changes

This PR adds the names of the steps in the console output if possible but not to the way that they are stored.

from zenml import step, pipeline


@step
def simon() -> int:
    print("Hello darkness")
    print("My old friend")
    print("I've come to talk with you again")
    return 3


@step
def axl() -> int:
    print("Take me down to the paradise city")
    print("Where the grass is green and the girls are pretty")
    print("Take me home, I'm on my way")
    print("I'm going back to the paradise city")
    return 3


@step
def freddie() -> int:
    print("Tonight, I'm gonna have myself a real good time")
    print("I feel alive and the world I'll turn it inside out")
    return 3


@pipeline(enable_cache=False, enable_step_logs=True)
def basic_pipeline():
    simon()
    axl()
    freddie()


basic_pipeline()

will return:

Initiating a new run for the pipeline: basic_pipeline.
Caching is disabled by default for basic_pipeline.
Using user: default
Using stack: default
  artifact_store: default
  orchestrator: default
Dashboard URL for Pipeline Run: http://127.0.0.1:8237/runs/b4576d64-fd48-4083-af73-c958ceb33657
Step axl has started.
[axl] Take me down to the paradise city
[axl] Where the grass is green and the girls are pretty
[axl] Take me home, I'm on my way
[axl] I'm going back to the paradise city
Step axl has finished in 0.043s.
Step freddie has started.
[freddie] Tonight, I'm gonna have myself a real good time
[freddie] I feel alive and the world I'll turn it inside out
Step freddie has finished in 0.043s.
Step simon has started.
[simon] Hello darkness
[simon] My old friend
[simon] I've come to talk with you again
Step simon has finished in 0.050s.
Pipeline run has finished in 0.227s.

but at the same time, the actual logs on the dashboard side looks like:

Screenshot 2025-04-01 at 15 37 56

Pre-requisites

Please ensure you have done the following:

  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • I have based my new branch on develop and the open PR is targeting develop. If your branch wasn't based on develop read Contribution guide on rebasing branch to develop.
  • IMPORTANT: I made sure that my changes are reflected properly in the following resources:
    • ZenML Docs
    • Dashboard: Needs to be communicated to the frontend team.
    • Templates: Might need adjustments (that are not reflected in the template tests) in case of non-breaking changes and deprecations.
    • Projects: Depending on the version dependencies, different projects might get affected.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Other (add details above)

Summary by CodeRabbit

  • New Features
    • Enhanced log messages by automatically including execution context details when available.
  • Bug Fixes
    • Fixed error output handling to ensure log messages are captured and displayed accurately.

@bcdurak bcdurak requested review from htahir1 and stefannica April 1, 2025 12:39
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 1, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The changes in the pull request modify the logging functionality in the StepLogsStorageContext class. The new update introduces the get_step_context import and uses it to obtain the current step context. If a context is available and the message is not just a newline, the message is prefixed with the step name before being written. Additionally, the assignment for standard error output has been corrected by wrapping the correct stderr methods.

Changes

File Summary
src/zenml/logging/step_logging.py Added import for get_step_context; modified _wrap_write to prefix messages with the step name when available and corrected stderr method assignments

Sequence Diagram(s)

sequenceDiagram
    participant S as StepLogsStorageContext
    participant GC as get_step_context
    participant OS as Output Stream

    S->>GC: Call get_step_context()
    alt Context found
        GC-->>S: Return step context (with step name)
        S->>S: Check if message is not newline
        S->>S: Prefix message with step name
    else No context
        GC-->>S: Return None
    end
    S->>OS: Write original or prefixed message
Loading

Poem

In the burrow of code, I happily bound,
Step logs now sing with a whimsical sound.
With context in hand, messages gleam bright,
Stderr and stdout now treat errors right.
I'm a rabbit of joy, leaping through each line,
Celebrating clean code in a hop so divine!
🐇✨


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added internal To filter out internal PRs and issues enhancement New feature or request labels Apr 1, 2025
@htahir1
Copy link
Contributor

htahir1 commented Apr 1, 2025

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Apr 1, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68719df and 3384e37.

📒 Files selected for processing (1)
  • src/zenml/logging/step_logging.py (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`src/zenml/**/*.py`: Review the Python code for conformity with Python best practices.

src/zenml/**/*.py: Review the Python code for conformity with Python best practices.

  • src/zenml/logging/step_logging.py
🪛 GitHub Actions: ci-fast
src/zenml/logging/step_logging.py

[error] 1-1: Ruff formatting check failed. Would reformat: src/zenml/logging/step_logging.py. Run 'ruff format' to fix code style issues.

🔇 Additional comments (1)
src/zenml/logging/step_logging.py (1)

25-25: Added import for step context functionality

The added import get_step_context is necessary for the implementation of step name prefixing in console logs.

@github-actions
Copy link
Contributor

github-actions bot commented Apr 1, 2025

Documentation Link Check Results

Absolute links check passed
Relative links check passed
Last checked: 2025-04-01 16:06:34 UTC

@bcdurak bcdurak added the run-slow-ci Tag that is used to trigger the slow-ci label Apr 1, 2025
@stefannica stefannica merged commit d36a477 into develop Apr 3, 2025
71 of 72 checks passed
@stefannica stefannica deleted the feature/appending-step-names-to-logs branch April 3, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request internal To filter out internal PRs and issues run-slow-ci Tag that is used to trigger the slow-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants