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

Removing the deprecated log_xxx_metadata calls #28

Merged
merged 7 commits into from
Dec 2, 2024
Merged

Removing the deprecated log_xxx_metadata calls #28

merged 7 commits into from
Dec 2, 2024

Conversation

bcdurak
Copy link
Contributor

@bcdurak bcdurak commented Nov 28, 2024

Summary by CodeRabbit

  • New Features

    • Updated default input for the Run tests step to enhance workflow efficiency.
  • Bug Fixes

    • Improved logging of metadata during data preprocessing and model evaluation processes.
  • Documentation

    • Clarified changes in logging functions and parameters for better understanding of data handling.

@bcdurak bcdurak requested a review from schustmi November 28, 2024 13:35
Copy link

coderabbitai bot commented Nov 28, 2024

Walkthrough

The pull request introduces changes to the workflow configuration and updates the logging method in two functions. The .github/workflows/ci.yml file now defaults the ref-zenml input parameter to 'feature/followup-run-metadata'. The data_preprocessor and model_evaluator functions in template/steps/ have replaced the log_artifact_metadata function with log_metadata, incorporating an infer_artifact parameter. These changes do not affect the functions' signatures or their core logic.

Changes

File Change Summary
.github/workflows/ci.yml Updated default value of ref-zenml input parameter from 'develop' to 'feature/followup-run-metadata' in run-tests job.
template/steps/data_preprocessor.py Replaced log_artifact_metadata with log_metadata, added artifact_name and infer_artifact=True parameters.
template/steps/model_evaluator.py Updated import from log_artifact_metadata to log_metadata, added artifact_version_id parameter in logging function.

Possibly related PRs

  • Remove .value from metadata access #25: The changes in this PR involve updating how metadata is accessed, which relates to the logging functionality in the main PR that modifies the logging of metadata in the model_evaluator function.
  • Using zenml login for templates #26: This PR updates commands related to logging into the ZenML environment, which may indirectly relate to the workflow changes in the main PR that affect how tests are run in the ZenML context.

Suggested reviewers

  • schustmi
  • stefannica

Poem

In the workflow's gentle flow,
A new branch we now bestow.
With logs that shine, and data neat,
Our models dance, their tasks complete.
Oh, follow up, dear friends, with glee,
For metadata's now wild and free! 🐇✨

Warning

Rate limit exceeded

@bcdurak has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 16 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1124356 and b60e441.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1124356 and b60e441.

📒 Files selected for processing (1)
  • template/steps/model_evaluator.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • template/steps/model_evaluator.py

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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 resolve resolve all the CodeRabbit review comments.
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@bcdurak bcdurak changed the title 2024.11.28 Removing the deprecated log_xxx_metadata calls Nov 28, 2024
Copy link

@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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a200a13 and b8d4467.

📒 Files selected for processing (3)
  • .github/workflows/ci.yml (1 hunks)
  • template/steps/data_preprocessor.py (2 hunks)
  • template/steps/model_evaluator.py (2 hunks)
🔇 Additional comments (4)
template/steps/data_preprocessor.py (2)

10-10: LGTM: Import statement updated correctly

The import statement has been properly updated to use the new log_metadata function from zenml.


70-74: Verify metadata retrieval in inference pipeline

The logging call has been correctly updated to use the new log_metadata API. However, since this metadata is explicitly used for inference (as noted in the comment "Log metadata so we can load it in the inference pipeline"), we should verify that the inference pipeline can still retrieve this metadata correctly with the new API.

Let's verify the metadata usage in inference-related code:

✅ Verification successful

Metadata retrieval is working correctly in the inference pipeline

The verification shows that the metadata is being correctly retrieved in the inference pipeline. In template/run.py, the metadata is accessed using the new API format:

random_state = preprocess_pipeline_artifact.run_metadata["random_state"]
target = preprocess_pipeline_artifact.run_metadata["target"]

This matches perfectly with how the metadata is being logged in the preprocessor step using log_metadata with artifact_name="preprocess_pipeline". The infer_artifact=True parameter ensures the metadata is properly associated with the artifact, making it accessible via the run_metadata property.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for metadata loading in inference-related files
rg -l "inference" | xargs rg -A 5 "(load_metadata|get_metadata)"

Length of output: 64


Script:

#!/bin/bash
# Let's try a broader search for metadata-related functions in Python files
rg -t py "(load_metadata|get_metadata|log_metadata)" -A 5

# Also search for files containing both "inference" and "metadata" to catch potential connections
rg -l "inference" | xargs rg "metadata"

Length of output: 6430

template/steps/model_evaluator.py (2)

7-7: LGTM: Import statement correctly updated

The import statement has been properly updated to reflect the new logging function.


82-85: Verify artifact inference behavior

The implementation looks correct, but let's verify the implications of infer_artifact=True:

  1. The metadata structure is preserved correctly
  2. The sklearn_classifier artifact name is still valid

Let's verify the consistency of this change across the codebase:

✅ Verification successful

Based on the results, I can now generate the final response:

Implementation is correct and consistent

The log_metadata function is imported from zenml and used consistently across the codebase:

  • Both usages in model_evaluator.py and data_preprocessor.py follow the same pattern
  • The function is properly imported from zenml in both files
  • No legacy log_artifact_metadata calls remain in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for consistent usage of log_metadata with infer_artifact
# across the codebase

# Check for any remaining uses of log_artifact_metadata
echo "Checking for any remaining log_artifact_metadata usage:"
rg "log_artifact_metadata"

# Check for consistent usage of log_metadata with infer_artifact
echo -e "\nChecking log_metadata usage patterns:"
rg -A 2 "log_metadata\(" 

Length of output: 756


Script:

#!/bin/bash
# Let's check the implementation of log_metadata function and its parameters
ast-grep --pattern 'def log_metadata($$$)'

# Also check for any imports or definitions related to this function
rg "log_metadata" -B 2

Length of output: 880

.github/workflows/ci.yml Show resolved Hide resolved
@bcdurak bcdurak changed the title Removing the deprecated log_xxx_metadata calls Removing the deprecated log_xxx_metadata calls Nov 28, 2024
Copy link

@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

🧹 Outside diff range and nitpick comments (1)
template/steps/model_evaluator.py (1)

Line range hint 76-81: Fix warning messages logic

The warning messages are only displayed when test accuracy is below threshold due to incorrect else block placement. This means warnings about low training accuracy might be missed.

Apply this diff to fix the warning logic:

     if tst_acc < min_test_accuracy:
         messages.append(
             f"Test accuracy {tst_acc*100:.2f}% is below {min_test_accuracy*100:.2f}% !"
         )
-    else:
-        for message in messages:
-            logger.warning(message)
+    
+    for message in messages:
+        logger.warning(message)
🧰 Tools
🪛 Ruff (0.8.0)

84-84: Undefined name log_metadata

(F821)


84-84: Undefined name metadata

(F821)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b8d4467 and fb8cdb7.

📒 Files selected for processing (1)
  • template/steps/model_evaluator.py (2 hunks)
🧰 Additional context used
🪛 Ruff (0.8.0)
template/steps/model_evaluator.py

7-7: zenml.log_ imported but unused

Remove unused import: zenml.log_

(F401)


84-84: Undefined name log_metadata

(F821)


84-84: Undefined name metadata

(F821)

template/steps/model_evaluator.py Outdated Show resolved Hide resolved
template/steps/model_evaluator.py Outdated Show resolved Hide resolved
@bcdurak bcdurak merged commit a992a9e into main Dec 2, 2024
13 checks passed
@bcdurak bcdurak deleted the 2024.11.28 branch December 2, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants