Skip to content

chore: cleanup source archive#3390

Merged
johanneskoester merged 2 commits intosnakemake:mainfrom
jakevc:feat--cleanup-sources
Mar 11, 2025
Merged

chore: cleanup source archive#3390
johanneskoester merged 2 commits intosnakemake:mainfrom
jakevc:feat--cleanup-sources

Conversation

@jakevc
Copy link
Copy Markdown
Contributor

@jakevc jakevc commented Mar 11, 2025

This PR cleans up the source archive if job_deploy_sources send them to remote storage

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

  • Refactor
    • Optimized the workflow process for handling source file deployment and cleanup by clearly separating the conditions that trigger these actions.
    • This change improves clarity and consistency, ensuring that source files are managed appropriately during execution.

@jakevc jakevc requested a review from johanneskoester as a code owner March 11, 2025 17:31
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 11, 2025

📝 Walkthrough

Walkthrough

The execute method of the Workflow class in snakemake/workflow.py has been refactored. A new boolean variable should_deploy_sources now encapsulates the conditions determining whether source files should be uploaded to storage. The logic for uploading sources and cleaning up the source archive has been reorganized to depend on this variable, clearly separating the condition from the action. No changes were made to any public or exported entities.

Changes

File(s) Change Summary
snakemake/.../workflow.py Refactored the execute method by introducing the should_deploy_sources boolean variable to control when source files are uploaded and cleaned up.

Sequence Diagram(s)

sequenceDiagram
    participant W as Workflow
    participant S as Storage
    participant C as Cleanup

    W->>W: Evaluate should_deploy_sources
    alt should_deploy_sources is true
        W->>S: Upload source files to storage
        W->>C: Clean up source archive
    else
        W->>W: Skip deployment and cleanup routines
    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 4ba62fe and 68ca89d.

📒 Files selected for processing (2)
  • snakemake/workflow.py (2 hunks)
  • snakemake/workflow.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.py`: Do not try to improve formatting. Do not suggest ...

**/*.py: Do not try to improve formatting.
Do not suggest type annotations for functions that are defined inside of functions or methods.
Do not suggest type annotation of the self argument of methods.
Do not suggest type annotation of the cls argument of classmethods.
Do not suggest return type annotation if a function or method does not contain a return statement.

  • snakemake/workflow.py
⏰ Context from checks skipped due to timeout of 90000ms (30)
  • GitHub Check: testing (10, 3.12, bash)
  • GitHub Check: testing (10, 3.11, bash)
  • GitHub Check: testing (9, 3.12, bash)
  • GitHub Check: testing (9, 3.11, bash)
  • GitHub Check: testing (8, 3.12, bash)
  • GitHub Check: testing (8, 3.11, bash)
  • GitHub Check: testing (7, 3.12, bash)
  • GitHub Check: testing (7, 3.11, bash)
  • GitHub Check: testing (6, 3.12, bash)
  • GitHub Check: testing (6, 3.11, bash)
  • GitHub Check: testing (5, 3.12, bash)
  • GitHub Check: testing (5, 3.11, bash)
  • GitHub Check: testing-windows (10)
  • GitHub Check: testing (4, 3.12, bash)
  • GitHub Check: testing-windows (9)
  • GitHub Check: testing (4, 3.11, bash)
  • GitHub Check: testing-windows (8)
  • GitHub Check: testing (3, 3.12, bash)
  • GitHub Check: testing-windows (7)
  • GitHub Check: testing (3, 3.11, bash)
  • GitHub Check: testing-windows (6)
  • GitHub Check: testing (2, 3.12, bash)
  • GitHub Check: testing-windows (5)
  • GitHub Check: testing (2, 3.11, bash)
  • GitHub Check: testing-windows (4)
  • GitHub Check: testing (1, 3.12, bash)
  • GitHub Check: testing-windows (3)
  • GitHub Check: testing (1, 3.11, bash)
  • GitHub Check: testing-windows (2)
  • GitHub Check: testing-windows (1)
🔇 Additional comments (2)
snakemake/workflow.py (2)

1206-1214: Good refactoring of the source deployment logic.

Encapsulating the complex conditional logic for source deployment into the should_deploy_sources variable improves code readability and maintainability. The variable name clearly expresses its purpose and makes the code easier to follow.


1294-1296: Good cleanup of source archive.

This change ensures that source archives are only cleaned up when they have been deployed, which properly handles the lifecycle of the source archive. Previously, this cleanup condition might have been less obvious or connected to the deployment logic.

✨ 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.
    • 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.

@sonarqubecloud
Copy link
Copy Markdown

@johanneskoester johanneskoester merged commit aab0d19 into snakemake:main Mar 11, 2025
41 checks passed
@jakevc
Copy link
Copy Markdown
Contributor Author

jakevc commented Mar 12, 2025

tested and confirmed this is working as expected!

kjohnsen pushed a commit to kjohnsen/snakemake that referenced this pull request Dec 15, 2025
This PR cleans up the source archive if job_deploy_sources send them to
remote storage

### QC
<!-- Make sure that you can tick the boxes below. -->

* [ ] 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).


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Optimized the workflow process for handling source file deployment and
cleanup by clearly separating the conditions that trigger these actions.
- This change improves clarity and consistency, ensuring that source
files are managed appropriately during execution.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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