From 66df515e0029eb9cd2e7c0ece0de34ce6856cb02 Mon Sep 17 00:00:00 2001 From: Corban Beaird Date: Mon, 14 Oct 2024 09:40:41 -0600 Subject: [PATCH 01/13] fix: allow webUI attempts to delete workspaces that historically had experiments --- webui/react/src/pages/WorkspaceList/WorkspaceActionDropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webui/react/src/pages/WorkspaceList/WorkspaceActionDropdown.tsx b/webui/react/src/pages/WorkspaceList/WorkspaceActionDropdown.tsx index 99784d5adbd..c6d0b669482 100644 --- a/webui/react/src/pages/WorkspaceList/WorkspaceActionDropdown.tsx +++ b/webui/react/src/pages/WorkspaceList/WorkspaceActionDropdown.tsx @@ -156,7 +156,7 @@ export const useWorkspaceActionMenu: (props: WorkspaceMenuPropsIn) => WorkspaceM } else if (!workspace.archived) { menuItems.push({ key: MenuKey.Edit, label: 'View Config' }); } - if (canDeleteWorkspace({ workspace }) && workspace.numExperiments === 0) { + if (canDeleteWorkspace({ workspace })) { menuItems.push({ type: 'divider' }); menuItems.push({ danger: true, key: MenuKey.Delete, label: 'Delete...' }); } From adcaa6b1776f3aa99fbb0b8b2bf193ccb98939be Mon Sep 17 00:00:00 2001 From: Corban Beaird Date: Mon, 14 Oct 2024 10:29:48 -0600 Subject: [PATCH 02/13] chore: add backend check on if a workspace has experiments during deletion & add integration test --- master/internal/api_workspace.go | 43 +++++++++++++++++++--- master/internal/api_workspace_intg_test.go | 41 ++++++++++++++++++++- 2 files changed, 77 insertions(+), 7 deletions(-) diff --git a/master/internal/api_workspace.go b/master/internal/api_workspace.go index d082467cc3d..9f3b1574c8f 100644 --- a/master/internal/api_workspace.go +++ b/master/internal/api_workspace.go @@ -307,6 +307,17 @@ func (a *apiServer) workspaceHasModels(ctx context.Context, workspaceID int32) ( return exists, nil } +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). + Exists(ctx) + if err != nil { + return false, fmt.Errorf("checking workspace for experiments: %w", err) + } + return exists, nil +} + func (a *apiServer) GetWorkspace( ctx context.Context, req *apiv1.GetWorkspaceRequest, ) (*apiv1.GetWorkspaceResponse, error) { @@ -1293,15 +1304,35 @@ func (a *apiServer) DeleteWorkspace( return nil, err } - modelsExist, err := a.workspaceHasModels(ctx, req.Id) - if err != nil { - return nil, err + checks := []struct { + checkFunc func(context.Context, int32) (bool, error) + errorStr string + }{ + {a.workspaceHasModels, "workspace (%d) contains models; move or delete models first"}, + {a.workspaceHasExperiments, "workspace (%d) contains experiments; move or delete experiments first"}, } - if modelsExist { - return nil, status.Errorf(codes.FailedPrecondition, "workspace (%d) contains models; move or delete models first", - req.Id) + + for _, check := range checks { + exists, err := check.checkFunc(ctx, req.Id) + if err != nil { + return nil, err + } + if exists { + return nil, status.Errorf(codes.FailedPrecondition, check.errorStr, req.Id) + } } + // modelsExist, err := a.workspaceHasModels(ctx, req.Id) + // if err != nil { + // return nil, err + // } + // if modelsExist { + // return nil, status.Errorf(codes.FailedPrecondition, "workspace (%d) contains models; move or delete models first", + // req.Id) + // } + + // experimentsExist, err := + holder := &workspacev1.Workspace{} // TODO(kristine): DET-10138 update workspace state in transaction with template delete err = a.m.db.QueryProto("deletable_workspace", holder, req.Id) diff --git a/master/internal/api_workspace_intg_test.go b/master/internal/api_workspace_intg_test.go index 72e6d3358d3..cc1ee8b22a7 100644 --- a/master/internal/api_workspace_intg_test.go +++ b/master/internal/api_workspace_intg_test.go @@ -10,6 +10,7 @@ import ( "fmt" "strconv" "testing" + "time" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -939,7 +940,7 @@ func TestDeleteWorkspace(t *testing.T) { mockRM := MockRM() noName := "" // set up api server - api, _, ctx := setupAPITest(t, nil, mockRM) + api, curUser, ctx := setupAPITest(t, nil, mockRM) api.m.allRms = map[string]rm.ResourceManager{noName: mockRM} // set up command service - required for successful DeleteWorkspaceRequest calls cs, err := command.NewService(api.m.db, api.m.rm) @@ -1002,6 +1003,44 @@ func TestDeleteWorkspace(t *testing.T) { Id: resp.Workspace.Id, }) require.Error(t, err) + + // create another workspace, and add a experiment + w, p := createProjectAndWorkspace(ctx, t, api) + err = db.Bun().RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { + autoGeneratedNamespaceName, err := getAutoGeneratedNamespaceName(ctx, w, &tx) + require.NoError(t, err) + autoCreatedNamespace = autoGeneratedNamespaceName + return nil + }) + require.NoError(t, err) + e := createTestExpWithProjectID(t, api, curUser, p) + _, err = db.Bun().NewUpdate().Table("experiments"). + Set("state = ?", model.CompletedState). + Where("id = ?", e.ID).Exec(ctx) + require.NoError(t, err) + _, err = api.DeleteWorkspace(ctx, &apiv1.DeleteWorkspaceRequest{ + Id: int32(w), + }) + + require.Error(t, err) + // delete experiment, so that workspace can be deleted + _, err = api.DeleteExperiment(ctx, &apiv1.DeleteExperimentRequest{ExperimentId: int32(e.ID)}) + require.NoError(t, err) + + // since delete experiment is async, we need to wait for the experiment to be deleted + for i := 0; i < 10; i++ { + _, err = api.GetExperiment(ctx, &apiv1.GetExperimentRequest{ExperimentId: int32(e.ID)}) + if err != nil { + break + } + time.Sleep(1 * time.Second) + } + // delete the workspace successfully + mockRM.On("DeleteNamespace", *autoCreatedNamespace).Return(nil).Once() + _, err = api.DeleteWorkspace(ctx, &apiv1.DeleteWorkspaceRequest{ + Id: int32(w), + }) + require.NoError(t, err) } func TestSetWorkspaceNamespaceBindings(t *testing.T) { From eefdedf837fa4c0e23f1b19622934815e345bfcf Mon Sep 17 00:00:00 2001 From: Max Russell Date: Thu, 24 Oct 2024 17:51:43 -0700 Subject: [PATCH 03/13] fix: remove commented code --- master/internal/api_workspace.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/master/internal/api_workspace.go b/master/internal/api_workspace.go index 9f3b1574c8f..98a74748ef4 100644 --- a/master/internal/api_workspace.go +++ b/master/internal/api_workspace.go @@ -1322,17 +1322,6 @@ func (a *apiServer) DeleteWorkspace( } } - // modelsExist, err := a.workspaceHasModels(ctx, req.Id) - // if err != nil { - // return nil, err - // } - // if modelsExist { - // return nil, status.Errorf(codes.FailedPrecondition, "workspace (%d) contains models; move or delete models first", - // req.Id) - // } - - // experimentsExist, err := - holder := &workspacev1.Workspace{} // TODO(kristine): DET-10138 update workspace state in transaction with template delete err = a.m.db.QueryProto("deletable_workspace", holder, req.Id) From fa9bcfaece5be0f56e827074761c9fad6174ac0b Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 16:28:42 -0700 Subject: [PATCH 04/13] Fix a couple e2e tests --- e2e_tests/tests/cluster/test_agent_user_group.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/e2e_tests/tests/cluster/test_agent_user_group.py b/e2e_tests/tests/cluster/test_agent_user_group.py index 740f0330efa..5b375e03eda 100644 --- a/e2e_tests/tests/cluster/test_agent_user_group.py +++ b/e2e_tests/tests/cluster/test_agent_user_group.py @@ -102,6 +102,10 @@ def test_workspace_post_gid() -> None: _check_test_experiment(sess, p.id) _check_test_command(sess, w.name) finally: + # Delete the project so the workspace can be deleted + bindings.delete_DeleteProject(sess, id=p.id) + # Wait for the delete to finish + time.sleep(0.5) _delete_workspace_and_check(sess, w) @@ -141,6 +145,10 @@ def test_workspace_patch_gid() -> None: _check_test_experiment(sess, p.id) _check_test_command(sess, w.name) finally: + # Delete the project so the workspace can be deleted + bindings.delete_DeleteProject(sess, id=p.id) + # Wait for the delete to finish + time.sleep(0.5) _delete_workspace_and_check(sess, w) From a7e56d4864417ded616a3ed79456c704a44ee75e Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 16:58:18 -0700 Subject: [PATCH 05/13] fix: another e2e test and some lint --- e2e_tests/tests/cluster/test_agent_user_group.py | 2 +- e2e_tests/tests/experiment/test_api.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/e2e_tests/tests/cluster/test_agent_user_group.py b/e2e_tests/tests/cluster/test_agent_user_group.py index 5b375e03eda..43b320db60b 100644 --- a/e2e_tests/tests/cluster/test_agent_user_group.py +++ b/e2e_tests/tests/cluster/test_agent_user_group.py @@ -102,7 +102,7 @@ def test_workspace_post_gid() -> None: _check_test_experiment(sess, p.id) _check_test_command(sess, w.name) finally: - # Delete the project so the workspace can be deleted + # Delete the project so the workspace can be deleted bindings.delete_DeleteProject(sess, id=p.id) # Wait for the delete to finish time.sleep(0.5) diff --git a/e2e_tests/tests/experiment/test_api.py b/e2e_tests/tests/experiment/test_api.py index a3707cae516..f7734120189 100644 --- a/e2e_tests/tests/experiment/test_api.py +++ b/e2e_tests/tests/experiment/test_api.py @@ -1,5 +1,6 @@ import uuid -from typing import Dict, List +import time +from typing import Dict, List, int import pytest @@ -13,6 +14,7 @@ def test_archived_proj_exp_list() -> None: admin = api_utils.admin_session() workspaces: List[bindings.v1Workspace] = [] + created_projects: List[int] = [] count = 2 for _ in range(count): @@ -34,6 +36,7 @@ def test_archived_proj_exp_list() -> None: workspaceId=wrkspc.id, ).project.id workspace_projects.append(pid) + created_projects.append(pid) for p in workspace_projects: for _ in range(count): @@ -105,5 +108,8 @@ def test_archived_proj_exp_list() -> None: for e_id in experiments: assert e_id in returned_e_id + for pid in created_projects: + bindings.delete_DeleteProject(admin, id=pid) + time.sleep(0.5) for w in workspaces: bindings.delete_DeleteWorkspace(admin, id=w.id) From b859ee7791c3928503064704e94567851baaf97f Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 17:14:18 -0700 Subject: [PATCH 06/13] even more linting --- e2e_tests/tests/experiment/test_api.py | 2 +- webui/react/scripts/README.md | 3 +-- webui/react/typings/dayjs.d.ts | 6 +++--- webui/react/typings/notebook.d.ts | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/e2e_tests/tests/experiment/test_api.py b/e2e_tests/tests/experiment/test_api.py index f7734120189..6b494f5a7b8 100644 --- a/e2e_tests/tests/experiment/test_api.py +++ b/e2e_tests/tests/experiment/test_api.py @@ -1,5 +1,5 @@ -import uuid import time +import uuid from typing import Dict, List, int import pytest diff --git a/webui/react/scripts/README.md b/webui/react/scripts/README.md index b78c950bdea..536affd21d6 100644 --- a/webui/react/scripts/README.md +++ b/webui/react/scripts/README.md @@ -7,7 +7,6 @@ eg a remote Determined master. For example, to connect the WebUI to a remote cluster with address `MY_SERVER_ADDRESS` you'd run the proxy with `./proxy.js MY_SERVER_ADDRESS`. This will start a local server which is -by default on port `8100`. This local server would now behave similar to `MY_SERVER_ADDRESS`. +by default on port `8100`. This local server would now behave similar to `MY_SERVER_ADDRESS`. You can now Use `http://localhost:8100/fixed` wherever you were running into CORS issues with before, instead of `MY_SERVER_ADDRESS`. - diff --git a/webui/react/typings/dayjs.d.ts b/webui/react/typings/dayjs.d.ts index f35ab0a9772..ec30292005e 100644 --- a/webui/react/typings/dayjs.d.ts +++ b/webui/react/typings/dayjs.d.ts @@ -1,8 +1,8 @@ declare module 'moment' { import { Dayjs } from 'dayjs'; namespace moment { - type Moment = Dayjs + type Moment = Dayjs; } - export = moment - export as namespace moment + export = moment; + export as namespace moment; } diff --git a/webui/react/typings/notebook.d.ts b/webui/react/typings/notebook.d.ts index df03185fd0f..6cf06c120af 100644 --- a/webui/react/typings/notebook.d.ts +++ b/webui/react/typings/notebook.d.ts @@ -1,3 +1,3 @@ declare module 'notebook' { - export default any; + export default any; } From 1f1b37f3390f585f04f12cb91c5614ef0b40c1fb Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 17:33:48 -0700 Subject: [PATCH 07/13] remove unnecessary import --- e2e_tests/tests/experiment/test_api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/tests/experiment/test_api.py b/e2e_tests/tests/experiment/test_api.py index 6b494f5a7b8..6bc40b198d3 100644 --- a/e2e_tests/tests/experiment/test_api.py +++ b/e2e_tests/tests/experiment/test_api.py @@ -1,6 +1,6 @@ import time import uuid -from typing import Dict, List, int +from typing import Dict, List import pytest From b219f62c2d67737971edbe3b7826523bb924cea5 Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 18:34:04 -0700 Subject: [PATCH 08/13] fix some more e2e tests --- e2e_tests/tests/cluster/test_rbac_ntsc.py | 15 +++++++++++++++ e2e_tests/tests/cluster/test_webhooks.py | 13 +++++++++++++ e2e_tests/tests/cluster/test_workspace_org.py | 5 +++++ e2e_tests/tests/experiment/test_allocation_csv.py | 3 +++ 4 files changed, 36 insertions(+) diff --git a/e2e_tests/tests/cluster/test_rbac_ntsc.py b/e2e_tests/tests/cluster/test_rbac_ntsc.py index d595138f3a8..82edb7620e1 100644 --- a/e2e_tests/tests/cluster/test_rbac_ntsc.py +++ b/e2e_tests/tests/cluster/test_rbac_ntsc.py @@ -1,4 +1,5 @@ import contextlib +import time from typing import Generator, List, Optional, Sequence import pytest @@ -134,6 +135,7 @@ def can_access_logs(sess: api.Session, ntsc_id: str) -> bool: ], ] ) as (workspaces, creds): + created_projects: List[int] = [] # launch one of each ntsc in the first workspace for typ in conf.ALL_NTSC: experiment_id = None @@ -143,6 +145,7 @@ def can_access_logs(sess: api.Session, ntsc_id: str) -> bool: body=bindings.v1PostProjectRequest(name="test", workspaceId=workspaces[0].id), workspaceId=workspaces[0].id, ).project.id + created_projects.append(pid) # experiment for tensorboard experiment_id = noop.create_experiment( @@ -233,6 +236,11 @@ def can_access_logs(sess: api.Session, ntsc_id: str) -> bool: # kill the ntsc api_utils.kill_ntsc(creds[0], typ, created_id) + # Delete the project so the workspace can be deleted + for pid in created_projects: + bindings.delete_DeleteProject(pid) + # Wait for deletion + time.sleep(0.5) @pytest.mark.e2e_cpu_rbac @@ -256,6 +264,7 @@ def get_proxy(sess: api.Session, task_id: str) -> Optional[errors.APIException]: ], ] ) as (workspaces, creds): + created_projects: List[int] = [] # launch one of each ntsc in the first workspace for typ in conf.PROXIED_NTSC: experiment_id = None @@ -265,6 +274,7 @@ def get_proxy(sess: api.Session, task_id: str) -> Optional[errors.APIException]: body=bindings.v1PostProjectRequest(name="test", workspaceId=workspaces[0].id), workspaceId=workspaces[0].id, ).project.id + created_projects.append(pid) # experiment for tensorboard experiment_id = noop.create_experiment( @@ -298,6 +308,11 @@ def get_proxy(sess: api.Session, task_id: str) -> Optional[errors.APIException]: # kill the ntsc api_utils.kill_ntsc(creds[0], typ, created_id) + for pid in created_projects: + # Delete the project so the workspace can be deleted + bindings.delete_DeleteProject(pid) + # Wait for deletion + time.sleep(0.5) @pytest.mark.e2e_cpu_rbac @api_utils.skipif_rbac_not_enabled() diff --git a/e2e_tests/tests/cluster/test_webhooks.py b/e2e_tests/tests/cluster/test_webhooks.py index fdcb65fd597..874b6c478ba 100644 --- a/e2e_tests/tests/cluster/test_webhooks.py +++ b/e2e_tests/tests/cluster/test_webhooks.py @@ -190,6 +190,10 @@ def test_log_pattern_send_webhook(should_match: bool) -> None: for i in ws_id: bindings.delete_DeleteWebhook(sess, id=i or 0) + # Delete the project so the workspace can be deleted + bindings.delete_DeleteProject(project.id) + # Wait for deletion + time.sleep(0.5) test_agent_user_group._delete_workspace_and_check(sess, workspace) @@ -274,6 +278,10 @@ def test_custom_webhook(isSlack: bool) -> None: assert str(experiment_id) in responses["/"] bindings.delete_DeleteWebhook(sess, id=w.id or 0) + # Delete the project so the workspace can be deleted + bindings.delete_DeleteProject(project.id) + # Wait for deletion + time.sleep(0.5) test_agent_user_group._delete_workspace_and_check(sess, workspace) @@ -336,6 +344,11 @@ def test_specific_webhook() -> None: bindings.delete_DeleteWebhook(sess, id=webhook_res_1.id or 0) bindings.delete_DeleteWebhook(sess, id=webhook_res_2.id or 0) + + # Delete the project so the workspace can be deleted + bindings.delete_DeleteProject(project.id) + # Wait for deletion + time.sleep(0.5) test_agent_user_group._delete_workspace_and_check(sess, workspace) diff --git a/e2e_tests/tests/cluster/test_workspace_org.py b/e2e_tests/tests/cluster/test_workspace_org.py index f22996ed69d..772fecb61d8 100644 --- a/e2e_tests/tests/cluster/test_workspace_org.py +++ b/e2e_tests/tests/cluster/test_workspace_org.py @@ -3,6 +3,7 @@ import os import random import re +import time import tempfile import uuid from typing import Generator, List, Optional, Tuple @@ -381,6 +382,10 @@ def test_workspace_org() -> None: assert e.value.status_code == http.HTTPStatus.CONFLICT finally: + # Clean out projects so workspaces can be cleaned + for p in test_projects: + bindings.delete_DeleteProject(sess, id=p.id) + time.sleep(0.5) # Clean out workspaces and all dependencies. for w in test_workspaces: bindings.delete_DeleteWorkspace(sess, id=w.id) diff --git a/e2e_tests/tests/experiment/test_allocation_csv.py b/e2e_tests/tests/experiment/test_allocation_csv.py index ef3483af697..cd32291b3b0 100644 --- a/e2e_tests/tests/experiment/test_allocation_csv.py +++ b/e2e_tests/tests/experiment/test_allocation_csv.py @@ -2,6 +2,7 @@ import datetime import io import re +import time import sys import uuid from typing import Optional @@ -99,6 +100,8 @@ def test_experiment_capture() -> None: assert r.status_code == requests.codes.ok, r.text validate_trial_csv_rows(r.text, exp_ref.id, w1.name) + bindings.delete_DeleteProject(session=sess, id=p1.id) + time.sleep(0.5) # Clean up test workspaces bindings.delete_DeleteWorkspace(session=sess, id=w1.id) bindings.delete_DeleteWorkspace(session=sess, id=w2.id) From a9ac51ca969a4a31d503612e1773e2f7f269c98d Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 23:11:03 -0700 Subject: [PATCH 09/13] fix e2e and some lint --- e2e_tests/tests/cluster/test_rbac_ntsc.py | 4 ++-- e2e_tests/tests/cluster/test_webhooks.py | 6 +++--- e2e_tests/tests/cluster/test_workspace_org.py | 2 +- e2e_tests/tests/experiment/test_allocation_csv.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e_tests/tests/cluster/test_rbac_ntsc.py b/e2e_tests/tests/cluster/test_rbac_ntsc.py index 82edb7620e1..647cfb9682a 100644 --- a/e2e_tests/tests/cluster/test_rbac_ntsc.py +++ b/e2e_tests/tests/cluster/test_rbac_ntsc.py @@ -238,7 +238,7 @@ def can_access_logs(sess: api.Session, ntsc_id: str) -> bool: api_utils.kill_ntsc(creds[0], typ, created_id) # Delete the project so the workspace can be deleted for pid in created_projects: - bindings.delete_DeleteProject(pid) + bindings.delete_DeleteProject(creds[0], id=pid) # Wait for deletion time.sleep(0.5) @@ -310,7 +310,7 @@ def get_proxy(sess: api.Session, task_id: str) -> Optional[errors.APIException]: for pid in created_projects: # Delete the project so the workspace can be deleted - bindings.delete_DeleteProject(pid) + bindings.delete_DeleteProject(creds[0], id=pid) # Wait for deletion time.sleep(0.5) diff --git a/e2e_tests/tests/cluster/test_webhooks.py b/e2e_tests/tests/cluster/test_webhooks.py index 874b6c478ba..b0740a16d80 100644 --- a/e2e_tests/tests/cluster/test_webhooks.py +++ b/e2e_tests/tests/cluster/test_webhooks.py @@ -191,7 +191,7 @@ def test_log_pattern_send_webhook(should_match: bool) -> None: for i in ws_id: bindings.delete_DeleteWebhook(sess, id=i or 0) # Delete the project so the workspace can be deleted - bindings.delete_DeleteProject(project.id) + bindings.delete_DeleteProject(sess, id=project.id) # Wait for deletion time.sleep(0.5) test_agent_user_group._delete_workspace_and_check(sess, workspace) @@ -279,7 +279,7 @@ def test_custom_webhook(isSlack: bool) -> None: bindings.delete_DeleteWebhook(sess, id=w.id or 0) # Delete the project so the workspace can be deleted - bindings.delete_DeleteProject(project.id) + bindings.delete_DeleteProject(sess, id=project.id) # Wait for deletion time.sleep(0.5) test_agent_user_group._delete_workspace_and_check(sess, workspace) @@ -346,7 +346,7 @@ def test_specific_webhook() -> None: bindings.delete_DeleteWebhook(sess, id=webhook_res_2.id or 0) # Delete the project so the workspace can be deleted - bindings.delete_DeleteProject(project.id) + bindings.delete_DeleteProject(sess, id=project.id) # Wait for deletion time.sleep(0.5) test_agent_user_group._delete_workspace_and_check(sess, workspace) diff --git a/e2e_tests/tests/cluster/test_workspace_org.py b/e2e_tests/tests/cluster/test_workspace_org.py index 772fecb61d8..08a2788f52c 100644 --- a/e2e_tests/tests/cluster/test_workspace_org.py +++ b/e2e_tests/tests/cluster/test_workspace_org.py @@ -3,8 +3,8 @@ import os import random import re -import time import tempfile +import time import uuid from typing import Generator, List, Optional, Tuple diff --git a/e2e_tests/tests/experiment/test_allocation_csv.py b/e2e_tests/tests/experiment/test_allocation_csv.py index cd32291b3b0..cbe9d711979 100644 --- a/e2e_tests/tests/experiment/test_allocation_csv.py +++ b/e2e_tests/tests/experiment/test_allocation_csv.py @@ -2,8 +2,8 @@ import datetime import io import re -import time import sys +import time import uuid from typing import Optional From 3e8ad2ec36fb990815d8960fd6d5f3a68e9c097b Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 23:21:12 -0700 Subject: [PATCH 10/13] how much linting is going to be necessary? --- e2e_tests/tests/cluster/test_rbac_ntsc.py | 1 + e2e_tests/tests/cluster/test_webhooks.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e_tests/tests/cluster/test_rbac_ntsc.py b/e2e_tests/tests/cluster/test_rbac_ntsc.py index 647cfb9682a..9f292a22f66 100644 --- a/e2e_tests/tests/cluster/test_rbac_ntsc.py +++ b/e2e_tests/tests/cluster/test_rbac_ntsc.py @@ -314,6 +314,7 @@ def get_proxy(sess: api.Session, task_id: str) -> Optional[errors.APIException]: # Wait for deletion time.sleep(0.5) + @pytest.mark.e2e_cpu_rbac @api_utils.skipif_rbac_not_enabled() def test_tsb_listed() -> None: diff --git a/e2e_tests/tests/cluster/test_webhooks.py b/e2e_tests/tests/cluster/test_webhooks.py index b0740a16d80..3149e4e0c61 100644 --- a/e2e_tests/tests/cluster/test_webhooks.py +++ b/e2e_tests/tests/cluster/test_webhooks.py @@ -344,7 +344,7 @@ def test_specific_webhook() -> None: bindings.delete_DeleteWebhook(sess, id=webhook_res_1.id or 0) bindings.delete_DeleteWebhook(sess, id=webhook_res_2.id or 0) - + # Delete the project so the workspace can be deleted bindings.delete_DeleteProject(sess, id=project.id) # Wait for deletion From fde6e4cb5b4a41001d8253dc91d2bb30d43f1257 Mon Sep 17 00:00:00 2001 From: Max Russell Date: Fri, 25 Oct 2024 23:43:31 -0700 Subject: [PATCH 11/13] Fix another e2e test --- e2e_tests/tests/cluster/test_workspace_org.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/e2e_tests/tests/cluster/test_workspace_org.py b/e2e_tests/tests/cluster/test_workspace_org.py index 08a2788f52c..dca71382ca3 100644 --- a/e2e_tests/tests/cluster/test_workspace_org.py +++ b/e2e_tests/tests/cluster/test_workspace_org.py @@ -474,7 +474,8 @@ 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, id=e.id) + time.sleep(0.5) for w in workspaces: # TODO check if it needs deleting. From 0808a9c9f6bb5a2bf09df4276bb0d5a558a26b76 Mon Sep 17 00:00:00 2001 From: Max Russell Date: Sat, 26 Oct 2024 00:24:49 -0700 Subject: [PATCH 12/13] lint again --- e2e_tests/tests/cluster/test_workspace_org.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e_tests/tests/cluster/test_workspace_org.py b/e2e_tests/tests/cluster/test_workspace_org.py index dca71382ca3..5553d8e9991 100644 --- a/e2e_tests/tests/cluster/test_workspace_org.py +++ b/e2e_tests/tests/cluster/test_workspace_org.py @@ -474,7 +474,7 @@ def setup_workspaces( for e in exps: if e.workspaceId not in wids: continue - bindings.delete_DeleteExperiment(session, id=e.id) + bindings.delete_DeleteExperiment(session, experimentId=e.id) time.sleep(0.5) for w in workspaces: From f74161277d13c9b99fb3cba2d96356c3d468e681 Mon Sep 17 00:00:00 2001 From: Max Russell Date: Sat, 26 Oct 2024 00:54:02 -0700 Subject: [PATCH 13/13] delete projects from workspace before deleting the workspace --- e2e_tests/tests/cluster/test_workspace_org.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/e2e_tests/tests/cluster/test_workspace_org.py b/e2e_tests/tests/cluster/test_workspace_org.py index 5553d8e9991..ffba1eb6881 100644 --- a/e2e_tests/tests/cluster/test_workspace_org.py +++ b/e2e_tests/tests/cluster/test_workspace_org.py @@ -478,6 +478,14 @@ def setup_workspaces( time.sleep(0.5) for w in workspaces: + projects = bindings.get_GetWorkspaceProjects( + session, + id=w.id, + sortBy=bindings.v1GetWorkspaceProjectsRequestSortBy.NAME, + ).projects + for p in projects: + bindings.delete_DeleteProject(session, id=p.id) + time.sleep(0.5) # TODO check if it needs deleting. bindings.delete_DeleteWorkspace(session, id=w.id)