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

add log path field to DO #5467

Merged
merged 1 commit into from
Feb 4, 2025
Merged

add log path field to DO #5467

merged 1 commit into from
Feb 4, 2025

Conversation

CamronStaley
Copy link
Contributor

@CamronStaley CamronStaley commented Feb 4, 2025

What changes are proposed in this pull request?

Adding a log_path field for DOs for executors that don't use airflow or have a prebuilt UI can provide a path to a cloud bucket allowing users to download logs in the UI.

How is this patch tested? If it is not, please explain why.

from fiftyone.operators.delegated import DelegatedOperationService
from bson import ObjectId

do = DelegatedOperationService()
dos = do.get(ObjectId("66e8cab28cecb3ff22558acb"))
print(dos)
do.set_running(dos.id, log_path="test/log/path")
dos = do.get(ObjectId("66e8cab28cecb3ff22558acb"))
print(dos)

Screenshot 2025-02-04 at 11 33 41 AM

Release Notes

Is this a user-facing change that should be mentioned in the release notes?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release
    notes for FiftyOne users.

What areas of FiftyOne does this PR affect?

  • App: FiftyOne application changes
  • Build: Build and test infrastructure changes
  • Core: Core fiftyone Python library changes
  • Documentation: FiftyOne documentation changes
  • Other

Summary by CodeRabbit

  • New Features
    • Added an optional logging path parameter to allow detailed tracking of delegated operations during state updates.
  • Refactor
    • Improved the clarity of error messages for better readability and maintenance.

@CamronStaley CamronStaley self-assigned this Feb 4, 2025
Copy link
Contributor

coderabbitai bot commented Feb 4, 2025

Walkthrough

The pull request enhances the logging capabilities within delegated operations by introducing an optional log_path parameter. Changes span across three components: the delegation repository, document, and service classes. The modifications involve updating method signatures and attribute initializations to support an additional log path field, along with minor code reformatting for improved readability.

Changes

File(s) Change Summary
fiftyone/factory/repos/delegated_operation.py Added the optional log_path parameter to the update_run_state method with conditional logic to update the database; reformatted the set_log_upload_error method's message for clarity.
fiftyone/factory/repos/delegated_operation_doc.py Introduced a new attribute log_path in DelegatedOperationDocument, initializing it in the constructor and populating it via from_pymongo.
fiftyone/operators/delegated.py Updated method signatures of set_running, set_completed, set_failed, and execute_operation to include an optional log_path parameter; enhanced docstrings and reformatted the set_log_upload_error return statement.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Service as DelegatedOperationService
    participant Repo as DelegatedOperationRepo
    participant Database

    Client->>Service: Execute operation (with optional log_path)
    Service->>Repo: update_run_state(..., log_path)
    alt log_path provided
        Repo->>Database: Update run state with log_path
    else no log_path
        Repo->>Database: Update run state normally
    end
    Service->>Client: Return operation status
Loading

Possibly related PRs

Suggested reviewers

  • swheaton

Poem

Hop, hop, through the code I go,
Adding log paths to make it flow.
With a twitch of nose and a bright byte,
Logging trails turn into delight.
A bunny’s hop in every line, oh what a show!
🐇💻

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

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.

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: 0

🧹 Nitpick comments (1)
fiftyone/factory/repos/delegated_operation_doc.py (1)

78-78: Simplify the dictionary lookup.

The second argument None in doc.get("log_path", None) is redundant since get() returns None by default when the key is not found.

Apply this diff to simplify the code:

-        self.log_path = doc.get("log_path", None)
+        self.log_path = doc.get("log_path")
🧰 Tools
🪛 Ruff (0.8.2)

78-78: Use doc.get("log_path") instead of doc.get("log_path", None)

Replace doc.get("log_path", None) with doc.get("log_path")

(SIM910)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9456b75 and 51d0a92.

📒 Files selected for processing (3)
  • fiftyone/factory/repos/delegated_operation.py (4 hunks)
  • fiftyone/factory/repos/delegated_operation_doc.py (2 hunks)
  • fiftyone/operators/delegated.py (12 hunks)
🧰 Additional context used
🪛 Ruff (0.8.2)
fiftyone/factory/repos/delegated_operation_doc.py

78-78: Use doc.get("log_path") instead of doc.get("log_path", None)

Replace doc.get("log_path", None) with doc.get("log_path")

(SIM910)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: test / test-python (ubuntu-latest-m, 3.10)
  • GitHub Check: test / test-app
  • GitHub Check: e2e / test-e2e
  • GitHub Check: lint / eslint
  • GitHub Check: build / build
  • GitHub Check: build
🔇 Additional comments (11)
fiftyone/factory/repos/delegated_operation_doc.py (1)

60-60: LGTM!

The log_path attribute is correctly initialized to None in the constructor.

fiftyone/factory/repos/delegated_operation.py (2)

47-47: LGTM!

The log_path parameter is correctly added to the method signature with appropriate type annotation.


345-347: LGTM!

The logic to update the log_path field in the database is correctly implemented with proper null check.

fiftyone/operators/delegated.py (8)

87-87: LGTM!

The log_path parameter is correctly added to the method signature and well-documented in the docstring.

Also applies to: 99-99


113-113: LGTM!

The log_path parameter is correctly passed to the repository's update_run_state method.


163-163: LGTM!

The log_path parameter is correctly added to the method signature and well-documented in the docstring.

Also applies to: 178-178


195-195: LGTM!

The log_path parameter is correctly passed to the repository's update_run_state method.


205-205: LGTM!

The log_path parameter is correctly added to the method signature and well-documented in the docstring.

Also applies to: 220-220


235-235: LGTM!

The log_path parameter is correctly passed to the repository's update_run_state method.


461-463: LGTM!

The log_path parameter is correctly added to the method signature and well-documented in the docstring.

Also applies to: 473-473


481-481: LGTM!

The log_path parameter is correctly passed to the repository's update_run_state method.

@sashankaryal sashankaryal self-requested a review February 4, 2025 18:06
Copy link
Contributor

@sashankaryal sashankaryal left a comment

Choose a reason for hiding this comment

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

lgtm! ✍️

@CamronStaley CamronStaley merged commit 124d447 into develop Feb 4, 2025
14 checks passed
@CamronStaley CamronStaley deleted the feat/log-path branch February 4, 2025 18:50
@minhtuev
Copy link
Contributor

minhtuev commented Feb 4, 2025

Ah just got around to read this PR now since we were in meetings this morning. Overall, LGTM, just a minor comment: we should consider adding a unit test so that the log_path field (and others) can be tested and validated automatically.

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.

3 participants