Skip to content

Commit

Permalink
Improve deletion of workspaces in ADS
Browse files Browse the repository at this point in the history
  • Loading branch information
SilkeSchomann committed Jan 10, 2025
1 parent 1654a3b commit 8fc6c5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/mslice/models/workspacemanager/workspace_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def get_workspace_name(workspace):


def delete_workspace(workspace):
workspace = get_workspace_handle(workspace)
try:
workspace = get_workspace_handle(workspace)
except KeyError:
return None
remove_workspace(workspace)
del workspace

Expand Down
13 changes: 10 additions & 3 deletions src/mslice/util/mantid/algorithm_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ def remove_from_ads(workspacename):
if AnalysisDataService.Instance().doesExist(workspacename):
AnalysisDataService.Instance().remove(workspacename)
# Remove hidden workspaces from ADS
workspacename = '__MSL' + workspacename
if AnalysisDataService.Instance().doesExist(workspacename):
AnalysisDataService.Instance().remove(workspacename)
hiddenworkspace = '__MSL' + workspacename
if AnalysisDataService.Instance().doesExist(hiddenworkspace):
AnalysisDataService.Instance().remove(hiddenworkspace)
hiddenworkspace = '__MSL__mat' + workspacename
if AnalysisDataService.Instance().doesExist(hiddenworkspace):
AnalysisDataService.Instance().remove(hiddenworkspace)
hiddenworkspace = '__MSL' + workspacename + '_HIDDEN'
print(AnalysisDataService.Instance().getObjectNames())
if AnalysisDataService.Instance().doesExist(hiddenworkspace):
AnalysisDataService.Instance().remove(hiddenworkspace)

0 comments on commit 8fc6c5d

Please sign in to comment.