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

Pull and clean #43

Merged
merged 12 commits into from
Mar 15, 2024
Merged

Pull and clean #43

merged 12 commits into from
Mar 15, 2024

Conversation

bohendo
Copy link
Collaborator

@bohendo bohendo commented Mar 15, 2024

  • Add pagination support to object getter, overcoming the prior limit of 1000 objects at a time
  • separate a CleanJob function out from CleanAll
  • add job flag to the clean command
  • use flag for specifying output path to pull into instead of an argument, give this param a sensible default
  • add force flag to clean/reset commands to bypass user confirmation
  • add pull-and-clean metacommand

Summary by CodeRabbit

  • New Feature: Introduced MergeAndSave function in state package for efficient state management.
  • New Feature: Enhanced DownloadJobOutput function in pull.go to handle log downloads and local directory creation.
  • Bug Fix: Modified PrintStatus function in status.go to display the latest job instead of the latest completed job, providing real-time status updates.
  • Refactor: Updated S3 upload path in user_data.sh.tmpl for cloud-init logs, improving log organization.
  • Refactor: Standardized naming convention for jobID across digitalocean.go and ssh.go, enhancing code consistency.
  • Chore: Introduced a new variable keyName in digitalocean.go for better droplet name formatting.

Copy link

github-actions bot commented Mar 15, 2024

Image description CodeRabbit

Walkthrough

This pull request introduces significant changes to the cloud execution command-line tool. It modifies function signatures, control structures, and variable assignments across multiple files. The changes include updates to state management, job handling, log downloading, status printing, and SSH key naming. These modifications aim to improve code consistency, maintainability, and functionality.

Changes

Files Summary
cmd/cloudexec/cancel.go, cmd/cloudexec/clean.go Modifications to logic and functionality, including changes to function signatures, control structures, function calls, and variable assignments.
cmd/cloudexec/launch.go, pkg/state/state.go Replaced calls to state.UpdateState with state.MergeAndSave. Introduced a new function removeDeletedJobs and modified error message in GetLatestCompletedJob.
cmd/cloudexec/pull.go Altered DownloadJobOutput function signature and added logic for downloading logs and creating local directories. Replaced fmt.Sprintf with filepath.Join for file paths.
cmd/cloudexec/status.go Modified PrintStatus function to use the latest job as default display instead of the latest completed job.
cmd/cloudexec/user_data.sh.tmpl Changed S3 upload path for cloud-init logs to a more specific location within the job's directory.
pkg/digitalocean/digitalocean.go, pkg/ssh/ssh.go Renamed parameter jobId to jobID in CreateDroplet function. Introduced a new variable keyName and formatted dropletName using this variable and jobID.

🐰💻

"In the land of code where the shadows lie,

We refactor, enhance, under the clouded sky.

With every keystroke, we create anew,

A world of functions, for me and you.

So here's to changes, big and small,

To better code, we give our all! 🎉"


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 20251d4 and a0783b9 commits.
Files selected (11)
  • cmd/cloudexec/cancel.go (1)
  • cmd/cloudexec/clean.go (1)
  • cmd/cloudexec/launch.go (2)
  • cmd/cloudexec/main.go (18)
  • cmd/cloudexec/pull.go (2)
  • cmd/cloudexec/status.go (1)
  • cmd/cloudexec/user_data.sh.tmpl (1)
  • pkg/digitalocean/digitalocean.go (3)
  • pkg/s3/s3.go (6)
  • pkg/ssh/ssh.go (7)
  • pkg/state/state.go (5)
Files not summarized due to errors (2)
  • cmd/cloudexec/main.go (diff tokens exceeds limit)
  • pkg/s3/s3.go (diff tokens exceeds limit)
Files skipped from review due to trivial changes (1)
  • pkg/ssh/ssh.go
Review comments generated (42)
  • Review: 31
  • LGTM: 11

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

cmd/cloudexec/status.go Show resolved Hide resolved
cmd/cloudexec/user_data.sh.tmpl Show resolved Hide resolved
pkg/digitalocean/digitalocean.go Show resolved Hide resolved
cmd/cloudexec/clean.go Show resolved Hide resolved
cmd/cloudexec/clean.go Show resolved Hide resolved
pkg/s3/s3.go Show resolved Hide resolved
pkg/s3/s3.go Show resolved Hide resolved
pkg/s3/s3.go Show resolved Hide resolved
pkg/s3/s3.go Show resolved Hide resolved
pkg/s3/s3.go Show resolved Hide resolved
@bohendo bohendo merged commit 1f11b45 into main Mar 15, 2024
6 checks passed
@bohendo bohendo deleted the pull-and-clean branch March 15, 2024 21:13
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.

1 participant