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 naming per instance and delete by name #90

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

MSevey
Copy link
Member

@MSevey MSevey commented Mar 10, 2025

Overview

Closes #76

Confirm the following:

  1. instance creation workflow - creates with instance.name if provider, else instance_name+suffix
  2. instance deletion workflow - deletes by name (new API?) else FIFO

Needs Followup

Job vs Instance naming

It appears that job names and instance names are being used interchangeably. This is going to cause confusion and lead to errors due to complexity building around the re-use.
These two fields need to be split out and kept separate.

Unit Testing

Some of the large functions should really be split out to allow for better unit testing that avoids unnecessary DB and API mocks.

Delete All

Seems like low hanging fruit to allow for delete all if no instances are provided. Should just enable that.
This would eliminate the need to be tracking deletions and creations to submit the exact number of delete requests needed.

@MSevey MSevey requested a review from mojtaba-esk March 10, 2025 16:19
@MSevey MSevey self-assigned this Mar 10, 2025
WebhookURL string `json:"webhook_url"` // Webhook URL of the job
Provider string `json:"provider"` // Provider of the compute service
Instances []DeleteInstance `json:"instances"` // Instances to delete
InstanceName string `json:"instance_name"` // Base name for instances
Copy link
Member Author

Choose a reason for hiding this comment

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

revisit how job names are being used

Copy link
Member Author

Choose a reason for hiding this comment

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

should include job name as well

Comment on lines +56 to +57
if r.InstanceName == "" {
return fmt.Errorf("instance_name is required")
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think this is required. revert to job name?

@@ -99,18 +102,18 @@ func (s *InstanceService) DeleteInstance(
Model: gorm.Model{
ID: jobID,
},
Name: name,
Copy link
Member Author

Choose a reason for hiding this comment

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

this should be job name.

ProjectName: projectName,
Status: models.JobStatusPending,
}

// Create infrastructure request
infraReq := &infrastructure.JobRequest{
Name: name,
Copy link
Member Author

Choose a reason for hiding this comment

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

this should be additive and be job name as well

Name: instance.Name,
ProjectName: infraReq.ProjectName,
Provider: infraReq.Provider,
InstanceName: instance.Name,
Copy link
Member Author

Choose a reason for hiding this comment

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

should have job name too

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.

Improve Instance Naming System
1 participant