Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Allow specifying duration in jmp client shell command#365

Merged
mangelajo merged 7 commits intomainfrom
duration
Mar 20, 2025
Merged

Allow specifying duration in jmp client shell command#365
mangelajo merged 7 commits intomainfrom
duration

Conversation

@NickCao
Copy link
Copy Markdown
Collaborator

@NickCao NickCao commented Mar 20, 2025

Summary by CodeRabbit

  • New Features

    • Users can now specify a custom lease duration when connecting, with a default period of 30 minutes.
    • The CLI accepts multiple input formats for setting the duration.
  • Bug Fixes

    • Improved error handling in remote service interactions to enhance reliability.
  • Refactor

    • Lease duration handling has been revamped to use descriptive time values instead of raw numeric timeouts.
    • Simplified the ClientConfigV1Alpha1 class by removing unnecessary methods.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 20, 2025

Walkthrough

This pull request introduces a new duration parameter of type timedelta across various commands and services, enhancing lease management. The @opt_duration_partial decorator simplifies duration input from the CLI and sets a default of 30 minutes. The changes also update the lease creation logic in the Lease class, modify the configuration method signature, and incorporate improved error handling for gRPC calls through a context manager.

Changes

File(s) Change Summary
jumpstarter-cli-client/.../client_shell.py
jumpstarter-cli-client/.../common.py
jumpstarter-cli-client/.../create.py
Added a new duration parameter via the @opt_duration_partial decorator for CLI commands, updating function signatures and options to accept a timedelta (default 30 minutes).
jumpstarter/.../client/grpc.py Introduced translate_grpc_exceptions context manager to wrap asynchronous gRPC calls for improved error handling.
jumpstarter/.../client/lease.py Replaced the timeout attribute (int) with a duration attribute (timedelta) in the Lease class and updated related creation and logging logic.
jumpstarter/.../config/client.py Modified the lease method signature to include a duration parameter with a 30-minute default and removed legacy methods (request_lease, release_lease), along with adjustments in error handling for async calls.

Sequence Diagram(s)

sequenceDiagram
    participant User as CLI User
    participant Shell as client_shell
    participant Config as ClientConfig
    participant Lease as Lease Service
    participant gRPC as gRPC Client

    User->>Shell: Invoke client_shell(duration, lease_name, ...)
    Shell->>Config: Call lease(selector, lease_name, duration)
    Config->>Lease: Create Lease object with duration
    Lease->>gRPC: CreateLease call wrapped with error handler
    gRPC-->>Lease: Return lease data or error
    Lease-->>Config: Pass lease response
    Config-->>Shell: Return lease result
    Shell-->>User: Display output
Loading

Possibly related PRs

Suggested reviewers

  • mangelajo

Poem

I'm a hopping rabbit, full of cheer,
Leaping through code with changes so clear.
A 30-minute lease now guides our stride,
Decorators and error handlers side by side.
With joyful hops, our bugs take flight—
CodeRabbit sings in bytes of light!


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.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 20, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 3926324
🔍 Latest deploy log https://app.netlify.com/sites/jumpstarter-docs/deploys/67dc3cc57fd8ae0008bac2d3
😎 Deploy Preview https://deploy-preview-365--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Copy Markdown
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)
pyproject.toml (1)

72-75: Mapping for "Pn" in Typos Config

The new entry Pn = "Pn" has been added under [tool.typos.default.extend-words] to ensure that the term "Pn" is not flagged as a typo. This is a clear and straightforward configuration change. To further improve clarity for future maintainers, consider adding an inline comment explaining the purpose of this mapping.

73
ser = "ser"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cdc2618 and 3926324.

📒 Files selected for processing (1)
  • pyproject.toml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: pytest-matrix (3.11)
  • GitHub Check: pytest-matrix (3.13)
  • GitHub Check: pytest-matrix (3.12)
  • GitHub Check: e2e
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter Dockerfile)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-dev .devfile/Containerfile)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-utils Dockerfile.utils)
  • GitHub Check: build-and-push-image (jumpstarter-dev/jumpstarter-devspace .devfile/Containerfile.client)

@mangelajo mangelajo merged commit 36015dd into main Mar 20, 2025
18 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Mar 20, 2025
@NickCao NickCao deleted the duration branch March 31, 2025 15:44
@mangelajo mangelajo added this to the 0.6.0 milestone May 8, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Oct 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants