Skip to content

Conversation

@t0mdavid-m
Copy link
Member

@t0mdavid-m t0mdavid-m commented May 23, 2025

Fixes the bug that the log is not displayed on windows.

Summary by CodeRabbit

  • Bug Fixes
    • Improved workflow start behavior to prevent multiple workflows from being triggered by repeated button presses.
    • Removed unnecessary delay and automatic UI refresh after starting a workflow, resulting in a more responsive user experience.
  • New Features
    • Added periodic log display with selectable detail levels and workflow control buttons that refresh every 5 seconds for real-time monitoring.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 23, 2025

"""

Walkthrough

The Streamlit UI's execution_section was refactored to delegate log display and workflow control to a new show_log method with periodic refresh every 5 seconds. The workflow manager's start_workflow method added a guard clause to prevent duplicate starts and removed the previous delay and rerun after starting the workflow.

Changes

File(s) Change Summary
src/workflow/StreamlitUI.py Refactored execution_section to call new show_log method decorated with @st.fragment(run_every=5) that manages log display, workflow start/stop, and auto-refresh with a 3-second delay after starting workflow.
src/workflow/WorkflowManager.py Added guard clause in start_workflow to return if pid_dir exists, preventing duplicate starts; removed sleep and rerun logic after workflow start.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant StreamlitUI
    participant WorkflowManager

    User->>StreamlitUI: Clicks "Start Workflow"
    StreamlitUI->>WorkflowManager: start_workflow_function()
    WorkflowManager->>WorkflowManager: Check if pid_dir exists
    alt pid_dir exists
        WorkflowManager-->>StreamlitUI: Return immediately
    else pid_dir does not exist
        WorkflowManager->>WorkflowManager: Start workflow process
    end
    StreamlitUI->>StreamlitUI: Wait 3 seconds
    StreamlitUI->>StreamlitUI: st.rerun()
Loading

Poem

Logs refreshed with a gentle beat,
Workflow starts with a careful seat.
Guarded starts keep chaos at bay,
Bunny hops in a smooth ballet.
Every five seconds, the story's told—
In Streamlit's glow, the logs unfold! 🐇✨
"""

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8581865 and ae2e923.

📒 Files selected for processing (1)
  • src/workflow/StreamlitUI.py (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/workflow/StreamlitUI.py
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-openms
  • GitHub Check: build-full-app
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

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)
src/workflow/WorkflowManager.py (1)

35-36: Fix formatting issue and approve the guard clause logic.

The guard clause effectively prevents multiple concurrent workflow starts, which could help resolve Windows-specific timing issues with log file access. However, there's a formatting violation.

Apply this diff to fix the formatting:

-        # Catch double presses of the button while app is in frozen state
-        if self.executor.pid_dir.exists(): return
+        # Catch double presses of the button while app is in frozen state
+        if self.executor.pid_dir.exists():
+            return
🧰 Tools
🪛 Ruff (0.11.9)

36-36: Multiple statements on one line (colon)

(E701)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5bcc10 and 29bb33d.

📒 Files selected for processing (2)
  • src/workflow/StreamlitUI.py (1 hunks)
  • src/workflow/WorkflowManager.py (1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
src/workflow/WorkflowManager.py

36-36: Multiple statements on one line (colon)

(E701)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: build-full-app
  • GitHub Check: build-openms
🔇 Additional comments (1)
src/workflow/StreamlitUI.py (1)

1007-1007: LGTM! This delay addresses the Windows log display issue.

The 3-second delay allows sufficient time for the workflow process to start and create log files before the UI refreshes. This is particularly important on Windows where file system operations and process startup can have different timing characteristics compared to other operating systems. This change effectively fixes the bug where logs weren't displayed on Windows.

@t0mdavid-m t0mdavid-m merged commit c44e4c6 into develop May 25, 2025
5 checks passed
@coderabbitai coderabbitai bot mentioned this pull request May 25, 2025
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