Skip to content

Conversation

@jakevc
Copy link
Contributor

@jakevc jakevc commented Mar 14, 2025

resolves snakemake/snakemake-executor-plugin-aws-batch#19

QC

  • The PR contains a test case for the changes or the changes are already covered by an existing test case.
  • The documentation (docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced an optional storage configuration attribute that automatically derives a protocol string based on the provider selection, offering greater flexibility.
  • Refactor

    • Improved the logic for determining the source upload path. The updated approach now defaults to a standard cloud storage location when no valid prefix is provided, ensuring more consistent and predictable behavior.

@jakevc jakevc requested a review from johanneskoester as a code owner March 14, 2025 11:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 14, 2025

📝 Walkthrough

Walkthrough

This update introduces a new optional attribute, default_storage_protocol, to the StorageSettings class, which is initialized based on the default_storage_provider in the __post_init__ method. Additionally, the upload_sources method in the Workflow class has been modified to determine the prefix value using new logic that defaults to a specific S3 path under certain conditions, streamlining the construction of the prefix.

Changes

File Change Summary
src/snakemake/settings/types.py Added optional attribute default_storage_protocol in StorageSettings and updated __post_init__ to assign protocol string if provider is set.
src/snakemake/workflow.py Modified upload_sources method to set prefix to a default S3 path when prefix is falsy or equals the default storage protocol; trailing slash added if not.

Sequence Diagram(s)

sequenceDiagram
    participant SS as StorageSettings
    SS ->> SS: __post_init__()
    alt default_storage_provider is set
        SS -->> SS: Set default_storage_protocol = "{default_storage_provider}://"
    else
        SS -->> SS: default_storage_protocol remains None
    end
Loading
sequenceDiagram
    participant W as Workflow
    W ->> W: upload_sources(prefix)
    alt prefix is falsy or equals default_storage_protocol
        W -->> W: Set prefix = "s3://snakemake-workflow-sources/"
    else
        W -->> W: Append trailing slash to prefix
    end
Loading

Suggested reviewers

  • johanneskoester

📜 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 70e4741 and eb69d63.

📒 Files selected for processing (2)
  • src/snakemake/settings/types.py (2 hunks)
  • src/snakemake/workflow.py (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/snakemake/workflow.py
  • src/snakemake/settings/types.py
⏰ Context from checks skipped due to timeout of 90000ms (30)
  • GitHub Check: tests (10, windows-latest, py312)
  • GitHub Check: tests (10, ubuntu-latest, py312)
  • GitHub Check: tests (10, ubuntu-latest, py311)
  • GitHub Check: tests (9, windows-latest, py312)
  • GitHub Check: tests (9, ubuntu-latest, py312)
  • GitHub Check: tests (9, ubuntu-latest, py311)
  • GitHub Check: tests (8, windows-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py312)
  • GitHub Check: tests (8, ubuntu-latest, py311)
  • GitHub Check: tests (7, windows-latest, py312)
  • GitHub Check: tests (7, ubuntu-latest, py312)
  • GitHub Check: tests (7, ubuntu-latest, py311)
  • GitHub Check: tests (6, windows-latest, py312)
  • GitHub Check: tests (6, ubuntu-latest, py312)
  • GitHub Check: tests (6, ubuntu-latest, py311)
  • GitHub Check: tests (5, windows-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py312)
  • GitHub Check: tests (5, ubuntu-latest, py311)
  • GitHub Check: tests (4, windows-latest, py312)
  • GitHub Check: tests (4, ubuntu-latest, py312)
  • GitHub Check: tests (4, ubuntu-latest, py311)
  • GitHub Check: tests (3, windows-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py312)
  • GitHub Check: tests (3, ubuntu-latest, py311)
  • GitHub Check: tests (2, windows-latest, py312)
  • GitHub Check: tests (2, ubuntu-latest, py312)
  • GitHub Check: tests (2, ubuntu-latest, py311)
  • GitHub Check: tests (1, windows-latest, py312)
  • GitHub Check: tests (1, ubuntu-latest, py312)
  • GitHub Check: tests (1, ubuntu-latest, py311)

🪧 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 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.

@jakevc jakevc changed the title enable default default prefix for source archive upload fix: enable default default prefix for source archive upload Mar 14, 2025
self.remote_job_local_storage_prefix = self.local_storage_prefix

if self.default_storage_provider:
self.default_storage_protocol = f"{self.default_storage_provider}://"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is dangerous. The name of the provider is not always a valid schema name. We should rather extend the storage provider base class to return the desired schema name via a new abstract method.

prefix = self.storage_settings.default_storage_prefix
if prefix:
if not prefix or prefix == self.storage_settings.default_storage_protocol:
prefix = "s3://snakemake-workflow-sources/"
Copy link
Contributor

Choose a reason for hiding this comment

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

s3:// as a default? Is that intentional?

@jakevc
Copy link
Contributor Author

jakevc commented Mar 19, 2025

yes I will mark as draft and continue to think about a more robust implementation

@jakevc jakevc marked this pull request as draft March 19, 2025 22:42
@github-actions
Copy link
Contributor

This PR was marked as stale because it has been open for 6 months with no activity.

@github-actions github-actions bot added the stale label Sep 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete bucket when upload sources is in bucket at root

2 participants