Skip to content

Attach to job#42

Merged
bohendo merged 14 commits intomainfrom
attach-to-jobid
Mar 15, 2024
Merged

Attach to job#42
bohendo merged 14 commits intomainfrom
attach-to-jobid

Conversation

@bohendo
Copy link
Copy Markdown
Collaborator

@bohendo bohendo commented Mar 15, 2024

  • refactor droplet getter to get by tag instead of by name
  • rename droplets to feature the job id
  • create a new, separate ssh config file for each droplet
  • segregates logic for cancelling running jobs from logic for cleaning out the bucket
  • refactor ssh config file deletion logic while cancelling jobs
  • add new job flag to attach

resolves #33

Summary by CodeRabbit

  • Refactor: Improved code readability and maintainability across multiple files. This includes refactoring of functions related to job cancellation, droplet handling, and state management.
  • New Feature: Added user confirmation prompt before destroying a droplet and cancelling a job.
  • Refactor: Renamed JobInfo struct to Job for better clarity.
  • Refactor: Updated function signatures in cmd/cloudexec/init.go, cmd/cloudexec/pull.go, cmd/cloudexec/push.go, cmd/cloudexec/status.go, and pkg/s3/s3.go for improved consistency.
  • Refactor: Modified GetLogsFromBucket function to accept jobID instead of bucketName, enhancing the precision of log fetching.
  • Chore: Updated error messages and log output for better debugging and user experience.

@bohendo bohendo changed the title Attach to jobid Attach to job Mar 15, 2024
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 15, 2024

Image description CodeRabbit

Walkthrough

This pull request includes significant refactoring across multiple files to improve code readability, maintainability, and logic segregation. Changes include function signature modifications, renaming of variables and functions, and reorganization of job cancellation and bucket operations logic. The changes aim to enhance the overall code structure while maintaining the existing functionality.

Changes

Files Summary
cmd/cloudexec/cancel.go, cmd/cloudexec/clean.go, cmd/cloudexec/launch.go, pkg/digitalocean/digitalocean.go, pkg/state/state.go Refactored functions for improved readability and maintainability. Segregated logic for cancelling running jobs from cleaning out the bucket. Renamed JobInfo struct to Job and updated function signatures accordingly.
cmd/cloudexec/init.go, cmd/cloudexec/pull.go, cmd/cloudexec/push.go, cmd/cloudexec/status.go, pkg/s3/s3.go Removed bucket parameter from several functions and replaced it with a bucketName variable. Updated S3 function calls to reflect this change. Altered exported function signatures in bucket.go to remove bucket parameter.
cmd/cloudexec/logs.go, pkg/state/state.go Modified GetLogsFromBucket function signature to accept an int64 jobID instead of a bucketName string. Changed GetLatestCompletedJob function signature to take only a *State parameter.

"In the land of code where the shadows lie,

We refactor, rename, and simplify.

With each pull request, we strive,

To make our codebase come alive.

🐇💻🎉"


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
Copy Markdown

@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 5604787 and abe54fc commits.
Files selected (13)
  • cmd/cloudexec/cancel.go (1)
  • cmd/cloudexec/clean.go (2)
  • cmd/cloudexec/init.go (2)
  • cmd/cloudexec/launch.go (5)
  • cmd/cloudexec/logs.go (1)
  • cmd/cloudexec/main.go (12)
  • cmd/cloudexec/pull.go (4)
  • cmd/cloudexec/push.go (2)
  • cmd/cloudexec/status.go (2)
  • pkg/digitalocean/digitalocean.go (6)
  • pkg/s3/s3.go (9)
  • pkg/ssh/ssh.go (11)
  • pkg/state/state.go (9)
Files not summarized due to errors (2)
  • cmd/cloudexec/main.go (diff tokens exceeds limit)
  • pkg/ssh/ssh.go (diff tokens exceeds limit)
Files not reviewed due to errors (3)
  • pkg/digitalocean/digitalocean.go (no response)
  • pkg/s3/s3.go (no response)
  • pkg/ssh/ssh.go (no response)
Review comments generated (50)
  • Review: 23
  • LGTM: 27

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.

@bohendo bohendo merged commit 20251d4 into main Mar 15, 2024
@bohendo bohendo deleted the attach-to-jobid branch March 15, 2024 20:57
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.

Allow attaching to any running job

1 participant