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

feat: Add support for customer compute service account (#51, @hnawar) #52

Merged
merged 4 commits into from
Aug 14, 2024

Conversation

johanneskoester
Copy link
Collaborator

@johanneskoester johanneskoester commented Aug 14, 2024

Test for PR #51.

Summary by CodeRabbit

  • New Features

    • Added support for specifying a custom compute service account in the hello_world rule, enhancing flexibility for cloud interactions.
    • Introduced a new method to retrieve service account information, providing better control over job allocations.
  • Bug Fixes

    • Updated .gitignore to exclude the poetry.lock file, ensuring cleaner version control.
  • Documentation

    • Enhanced documentation for the hello_world rule to include the new googlebatch_service_account parameter, improving user guidance.

@vsoch @johanneskoester 
I am supporting a snakemake user to migrate to Batch, one of the
requirement that came up was the use of custom service account.

This is my attempt to add support for it, I would appreciate your
guidance on how best to contribute and test this PR

---------

Signed-off-by: Hatem Nawar <[email protected]>
Co-authored-by: hatem.nawar <[email protected]>
Co-authored-by: Johannes Köster <[email protected]>
Copy link

coderabbitai bot commented Aug 14, 2024

Warning

Rate limit exceeded

@johanneskoester has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 20 minutes and 1 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

Files that changed from the base of the PR and between b57fbdb and 4ee057c.

Walkthrough

The recent changes enhance the Snakemake executor plugin for Google Cloud Batch by adding support for custom service accounts. Users can now specify a service account email in the documentation, which is integrated into the executor's settings and job allocation policies, improving flexibility and security in managing cloud resources. Additionally, the .gitignore file has been updated to exclude the poetry.lock file, reflecting a change in dependency management practices.

Changes

File Change Summary
.gitignore Added poetry.lock to ignore list to prevent tracking of the dependency lock file.
docs/further.md Introduced googlebatch_service_account parameter in hello_world rule for specifying service accounts.
snakemake_executor_plugin_googlebatch/... Added service_account attribute to ExecutorSettings class for optional service account email.
snakemake_executor_plugin_googlebatch/... Enhanced get_allocation_policy method and added get_service_account method for service account management.
tests/init.py Updated import statements and return type of get_remote_execution_settings method to reflect new module organization.

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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

@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

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 61b6fe0 and 5e59f8c.

Files ignored due to path filters (1)
  • pyproject.toml is excluded by !pyproject.toml
Files selected for processing (4)
  • .gitignore (1 hunks)
  • docs/further.md (1 hunks)
  • snakemake_executor_plugin_googlebatch/init.py (1 hunks)
  • snakemake_executor_plugin_googlebatch/executor.py (2 hunks)
Additional context used
Path-based instructions (2)
snakemake_executor_plugin_googlebatch/__init__.py (1)

Pattern **/*.py: Do not suggest to add trailing commas.
Do not suggest type annotations for functions that are defined inside of functions or methods.

snakemake_executor_plugin_googlebatch/executor.py (1)

Pattern **/*.py: Do not suggest to add trailing commas.
Do not suggest type annotations for functions that are defined inside of functions or methods.

Markdownlint
docs/further.md

249-249: Column: 1
Hard tabs

(MD010, no-hard-tabs)


250-250: Column: 1
Hard tabs

(MD010, no-hard-tabs)


251-251: Column: 1
Hard tabs

(MD010, no-hard-tabs)


252-252: Column: 1
Hard tabs

(MD010, no-hard-tabs)


253-253: Column: 1
Hard tabs

(MD010, no-hard-tabs)

Ruff
snakemake_executor_plugin_googlebatch/executor.py

388-388: Missing return type annotation for public function get_service_account

(ANN201)


388-388: Missing type annotation for self in method

(ANN101)


388-388: Missing type annotation for function argument job

(ANN001)

Additional comments not posted (4)
.gitignore (1)

4-4: Change Approved: Added poetry.lock to .gitignore.

The addition of poetry.lock to the .gitignore file is a sensible choice if the intention is to manage dependencies without tracking the lock file in version control.

snakemake_executor_plugin_googlebatch/__init__.py (1)

158-165: Change Approved: Added service_account attribute to ExecutorSettings.

The addition of the service_account attribute enhances the configurability of the ExecutorSettings class, allowing users to specify a service account email. The metadata is correctly set to indicate its optional nature and environment variable support.

docs/further.md (1)

243-255: Change Approved: Added googlebatch_service_account parameter.

The addition of the googlebatch_service_account parameter in the hello_world rule allows users to specify a custom compute service account email, enhancing flexibility and customization.

Tools
Markdownlint

249-249: Column: 1
Hard tabs

(MD010, no-hard-tabs)


250-250: Column: 1
Hard tabs

(MD010, no-hard-tabs)


251-251: Column: 1
Hard tabs

(MD010, no-hard-tabs)


252-252: Column: 1
Hard tabs

(MD010, no-hard-tabs)


253-253: Column: 1
Hard tabs

(MD010, no-hard-tabs)

snakemake_executor_plugin_googlebatch/executor.py (1)

362-367: Verify the integration of service account logic.

Ensure that the get_service_account method is correctly retrieving and assigning the service account to the allocation_policy. Verify that this change aligns with the intended functionality and does not introduce any unintended side effects.

Verification successful

Integration of service account logic is correct.

The get_service_account method is properly integrated into the code. It retrieves the service account and assigns it to the allocation_policy as intended. No issues were found with this integration.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the integration of the `get_service_account` method.

# Test: Search for the usage of `get_service_account` to ensure it's correctly integrated.
rg --type python -A 5 $'get_service_account'

Length of output: 74


Script:

#!/bin/bash
# Description: Verify the integration of the `get_service_account` method.

# Test: Search for the usage of `get_service_account` to ensure it's correctly integrated.
rg --type py -A 5 $'get_service_account'

Length of output: 1076

snakemake_executor_plugin_googlebatch/executor.py Outdated Show resolved Hide resolved
docs/further.md Outdated Show resolved Hide resolved
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: 0

Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

Commits

Files that changed from the base of the PR and between 5e59f8c and b57fbdb.

Files selected for processing (1)
  • tests/init.py (2 hunks)
Additional context used
Path-based instructions (1)
tests/__init__.py (1)

Pattern **/*.py: Do not suggest to add trailing commas.
Do not suggest type annotations for functions that are defined inside of functions or methods.

Additional comments not posted (2)
tests/__init__.py (2)

32-32: LGTM! Ensure consistency with the updated type annotation.

The return type annotation change to snakemake.settings.types.RemoteExecutionSettings appears correct given the import change.


4-4: Verify the import path for snakemake.settings.types.

Ensure that snakemake.settings.types is the correct module path for RemoteExecutionSettings. This change suggests a restructuring in the Snakemake library.

@johanneskoester johanneskoester merged commit 8678e20 into main Aug 14, 2024
4 checks passed
@johanneskoester johanneskoester deleted the feat/service-account branch August 14, 2024 11:27
johanneskoester pushed a commit that referenced this pull request Aug 14, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.5.0](v0.4.0...v0.5.0)
(2024-08-14)


### Features

* Add support for customer compute service account
([#51](#51),
[@hnawar](https://github.com/hnawar))
([#52](#52))
([8678e20](8678e20))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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