-
Notifications
You must be signed in to change notification settings - Fork 359
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
fix: allow workspaces to be attempted to be deleted when experiments had existed historically [CM-412] #10050
base: main
Are you sure you want to change the base?
fix: allow workspaces to be attempted to be deleted when experiments had existed historically [CM-412] #10050
Conversation
…etion & add integration test
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #10050 +/- ##
==========================================
+ Coverage 54.60% 54.82% +0.21%
==========================================
Files 1260 840 -420
Lines 157635 83102 -74533
Branches 3632 0 -3632
==========================================
- Hits 86082 45563 -40519
+ Misses 71419 37539 -33880
+ Partials 134 0 -134
Flags with carried forward coverage won't be shown. Click here to find out more.
|
✅ Deploy Preview for determined-ui canceled.
|
master/internal/api_workspace.go
Outdated
} | ||
|
||
// modelsExist, err := a.workspaceHasModels(ctx, req.Id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Delete commented code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
web change LGTM
checkFunc func(context.Context, int32) (bool, error) | ||
errorStr string | ||
}{ | ||
{a.workspaceHasModels, "workspace (%d) contains models; move or delete models first"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maxrussell it looks like you took this over. can you unroll this loop?
func (a *apiServer) workspaceHasExperiments(ctx context.Context, workspaceID int32) (bool, error) { | ||
exists, err := db.Bun().NewSelect().Table("experiments"). | ||
Join("INNER JOIN projects ON experiments.project_id = projects.id"). | ||
Where("projects.workspace_id=?", workspaceID). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where("projects.workspace_id=?", workspaceID). | |
Where("projects.workspace_id = ?", workspaceID). |
@@ -1002,6 +1003,44 @@ func TestDeleteWorkspace(t *testing.T) { | |||
Id: resp.Workspace.Id, | |||
}) | |||
require.Error(t, err) | |||
|
|||
// create another workspace, and add a experiment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, put the new test in a separate test.
@@ -469,9 +474,18 @@ def setup_workspaces( | |||
for e in exps: | |||
if e.workspaceId not in wids: | |||
continue | |||
bindings.post_KillExperiment(session, id=e.id) | |||
bindings.delete_DeleteExperiment(session, experimentId=e.id) | |||
time.sleep(0.5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's up with the sleeping? is this waiting on the deletes to finish? if so there's no way this doesn't flake eventually haha.
Ticket
CM-412
Description
A bug in the webUI was found where workspaces couldn't be deleted if there had ever been an experiment present in the workspace at any point in time. This removes the frontend check to disable the delete action in the action dropdown & adds logic into the API to perform the experiment present check.
Test Plan
Checklist
docs/release-notes/
See Release Note for details.