Skip to content

Conversation

MialLewis
Copy link
Contributor

@MialLewis MialLewis commented Apr 16, 2025

Description of work

Summary of work

This PR ensures that the LoadAndMerge algorithm does not output workspaces to the ADS if run as a child algorithm, or the StoreInADS keyword set to equal False.

This behaviour was causing issues in algorithms down the line where hidden workspaces were being created in the ADS unexpectedly, contrary to specification.

To do this, I have exposed getAlwaysStoreInADS to python, and simply remove output workspaces from the ADS at the end of the algorithm. In the short term this is preferable to making changes to MergeRuns which would in all likelihood require more widespread changes to other algorithms. See: https://github.com/mantidproject/mantid/pull/39214/files#diff-a2152741e27e12b0ffd8a303849c522241c235238d6a500aef925ec3871b436cR117

Fixes #39041

To test:

  1. From File > Settings > Turn on Show Invisible Workspaces

  2. Run the following script (that uses LoadAndMerge internally:

from mantid.simpleapi import *

ReflectometryISISCalculatePolEff(NonMagInputRuns='POLREF00032130,POLREF00032132', ProcessingInstructions='270-292', BackgroundProcessingInstructions='520-640', MagInputRuns='POLREF00032131,POLREF00032133', MagProcessingInstructions='270-292', MagBackgroundProcessingInstructions='520-640', I0MonitorIndex=2, MonitorIntegrationWavelengthMin=2.5, MonitorIntegrationWavelengthMax=10, IncludeDiagnosticOutputs=True)
  1. Observe no hidden workspaces leaked to ADS

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@MialLewis MialLewis changed the title Stop hidden workspaces leaking to ADS during LoadAndMerge algorithm Stop hidden workspaces leaking to ADS during LoadAndMerge algorithm if run as child Apr 16, 2025
@MialLewis MialLewis added the ISIS: LSS Issue and pull requests relating to SANS and Reflectometry (Large Scale Structures) at ISIS label Apr 17, 2025
@MialLewis MialLewis marked this pull request as ready for review April 17, 2025 08:40
@sf1919 sf1919 added this to the Release 6.13 milestone Apr 22, 2025
@adriazalvarez adriazalvarez self-assigned this Apr 23, 2025
Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

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

It is working fine, temporary workspaces are not stuck in the ads anymore.
Just found a typo otherwise looks good.

@github-project-automation github-project-automation bot moved this from New to In Progress in ISIS LSS Sprint Planning Apr 23, 2025
adriazalvarez
adriazalvarez previously approved these changes Apr 24, 2025
Copy link
Contributor

@adriazalvarez adriazalvarez left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this.

@cailafinn cailafinn self-assigned this Apr 24, 2025
Copy link
Contributor

@cailafinn cailafinn left a comment

Choose a reason for hiding this comment

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

Just a quick couple of things to ask before merging:

Copy link
Contributor

@cailafinn cailafinn left a comment

Choose a reason for hiding this comment

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

This now looks good to me. Nice fix :shipit:

@cailafinn cailafinn merged commit 9dd39db into main Apr 25, 2025
10 checks passed
@cailafinn cailafinn deleted the fix_refl_create_trans_leak branch April 25, 2025 09:14
@github-project-automation github-project-automation bot moved this from In Progress to Done in ISIS LSS Sprint Planning Apr 25, 2025
glass-ships pushed a commit that referenced this pull request Apr 25, 2025
… if run as child (#39214)

* remove output workspaces from ads if child alg

* expose getAlwaysStoreInADS to fix PolDiffILLReduction

* add unit tests for LoadAndMerge ADS behaviour

* respond to review comments
@MialLewis MialLewis added the Reflectometry Issues and pull requests related to reflectometry label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS: LSS Issue and pull requests relating to SANS and Reflectometry (Large Scale Structures) at ISIS Reflectometry Issues and pull requests related to reflectometry
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

ReflectometryISISCreateTransmission creates hidden workspaces if run as a child algorithm
4 participants