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

fix: allow workspaces to be attempted to be deleted when experiments had existed historically [CM-412] #10050

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

corban-beaird
Copy link
Contributor

@corban-beaird corban-beaird commented Oct 14, 2024

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

  • CI passes

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 54.82%. Comparing base (dadf75e) to head (f741612).
Report is 70 commits behind head on main.

Files with missing lines Patch % Lines
master/internal/api_workspace.go 89.47% 2 Missing ⚠️
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     
Flag Coverage Δ
backend 45.40% <89.47%> (+0.02%) ⬆️
harness 72.74% <ø> (ø)
web ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
master/internal/api_workspace.go 66.89% <89.47%> (+0.82%) ⬆️

... and 424 files with indirect coverage changes

Copy link

netlify bot commented Oct 14, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit f741612
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/671ca01fcad14000086dc78a

}

// modelsExist, err := a.workspaceHasModels(ctx, req.Id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete commented code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! Thanks!

Copy link
Contributor

@johnkim-det johnkim-det left a comment

Choose a reason for hiding this comment

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

web change LGTM

@maxrussell maxrussell enabled auto-merge (squash) October 25, 2024 00:52
@maxrussell maxrussell requested a review from a team as a code owner October 25, 2024 23:58
checkFunc func(context.Context, int32) (bool, error)
errorStr string
}{
{a.workspaceHasModels, "workspace (%d) contains models; move or delete models first"},
Copy link
Contributor

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).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Contributor

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)
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants