Ticket #5158 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

History recording needs to be switch back on for python sub-algorithms

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Release 2.1
Component: Mantid Keywords:
Cc: pf9@… Blocked By:
Blocking: Tester: Peter Peterson

Description

SNSPowderReduction was using the fact that history was kept for sub-algorithms in Python. While the WorkflowAlgorithm stuff in #5051 is going on we need to turn this back on. This will mean that the functionality is at least the same as the last release

Change History

comment:1 Changed 8 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 8 years ago by Martyn Gigg

  • Cc pf9@… added

comment:3 Changed 8 years ago by Martyn Gigg

Sub-algorithms from PyAlgs are not children. Refs #5158

Until the Workflow algorithm stuff in #5051,#5157 is complete then they need to be left as top-level meaning their history is recorded so that SNSPowderReduction works as expected with GeneratePythonScript.

Changeset: 42a520df4bb96d42707fb4a57c137de7aacad542

comment:4 Changed 8 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:5 Changed 8 years ago by Martyn Gigg

Revert "Sub-algorithms from PyAlgs are not children. Refs #5158"

This reverts commit 42a520df4bb96d42707fb4a57c137de7aacad542 until I find out why it hangs the tests.

Changeset: a3399ffcd0f9c3ecab420e7809870706fc9004e7

comment:6 Changed 8 years ago by Martyn Gigg

Enable history for child alg in python. Refs #5158

Setting them as parents causes issues with the workspace locking and really isn't the right thing to do.

Changeset: 7f8da4480fb15786091b288cc9b024c7e76cf377

comment:7 Changed 8 years ago by Martyn Gigg

Sub-algorithms from PyAlgs are not children. Refs #5158

Until the Workflow algorithm stuff in #5051,#5157 is complete then they need to be left as top-level meaning their history is recorded so that SNSPowderReduction works as expected with GeneratePythonScript.

Changeset: 42a520df4bb96d42707fb4a57c137de7aacad542

comment:8 Changed 8 years ago by Martyn Gigg

Revert "Sub-algorithms from PyAlgs are not children. Refs #5158"

This reverts commit 42a520df4bb96d42707fb4a57c137de7aacad542 until I find out why it hangs the tests.

Changeset: a3399ffcd0f9c3ecab420e7809870706fc9004e7

comment:9 Changed 8 years ago by Martyn Gigg

Enable history for child alg in python. Refs #5158

Setting them as parents causes issues with the workspace locking and really isn't the right thing to do.

Changeset: 7f8da4480fb15786091b288cc9b024c7e76cf377

comment:10 Changed 8 years ago by Peter Peterson

  • Status changed from verify to verifying
  • Tester set to Peter Peterson

comment:11 Changed 8 years ago by Peter Peterson

  • Status changed from verifying to reopened
  • Resolution fixed deleted

The history from the dawn of the data does not follow it. Only the last bits do. Try to run the Broken algorithm below and check the history of the output workspace. It shows only one load and plus, skipping the other load.

from MantidFramework import *
from mantidsimple import *
from mantid.api import AlgorithmFactory

class Broken(PythonAlgorithm):
    def PyInit(self):
        self.declareFileProperty("left", "", FileAction.Load)
        self.declareFileProperty("right", "", FileAction.Load)
        self.declareWorkspaceProperty("OutputWorkspace", "",
                                      Direction=Direction.Output)
    def PyExec(self):
        Load(Filename=self.getPropertyValue("left"), OutputWorkspace="left")
        right = Load(self.getPropertyValue("right"), OutputWorkspace="right")
        left = mtd['left']
        right = mtd['right']
        left += right
        self.setProperty("OutputWorkspace", left)

mtd.registerPyAlgorithm(Broken())

comment:12 Changed 8 years ago by Martyn Gigg

  • Status changed from reopened to accepted

comment:13 Changed 8 years ago by Martyn Gigg

Fix history recording in python algs. Refs #5158

If history is being recorded, the execution counted needs to be incremented.

Changeset: 897a24b7382e0f6faf08ccd90f125605f268172a

comment:14 Changed 8 years ago by Martyn Gigg

So now I get something which looks correct.

---------------------------------------------------------------------------
Wed 2. May 14:29:13 2012: Script execution started.
---------------------------------------------------------------------------
Framework Version: 2.0.2392
OS name: Windows NT
OS version: 6.1 (Build 7601: Service Pack 1)

Histories:

  Algorithm: Load   v1
  Execution Date: 2012-May-02 13:28:58
  Execution Duration: 0.654 seconds
  Parameters:
    Name: Filename, Value: C:\MantidProject\src\mantid\Test\AutoTestData\LOQ48127.raw, Default?: No, Direction: Input
    Name: OutputWorkspace, Value: left, Default?: No, Direction: Output
    Name: LoaderName, Value: LoadRaw, Default?: No, Direction: Output
    Name: Cache, Value: If Slow, Default?: Yes, Direction: Input
    Name: LoadLogFiles, Value: 1, Default?: Yes, Direction: Input
    Name: SpectrumMin, Value: 1, Default?: Yes, Direction: Input
    Name: SpectrumMax, Value: 2147483647, Default?: Yes, Direction: Input
    Name: SpectrumList, Value: , Default?: Yes, Direction: Input
    Name: LoadMonitors, Value: Include, Default?: Yes, Direction: Input

  Algorithm: Load   v1
  Execution Date: 2012-May-02 13:28:59
  Execution Duration: 0.269 seconds
  Parameters:
    Name: Filename, Value: C:\MantidProject\src\mantid\Test\AutoTestData\LOQ48127.raw, Default?: No, Direction: Input
    Name: OutputWorkspace, Value: right, Default?: No, Direction: Output
    Name: LoaderName, Value: LoadRaw, Default?: No, Direction: Output
    Name: Cache, Value: If Slow, Default?: Yes, Direction: Input
    Name: LoadLogFiles, Value: 1, Default?: Yes, Direction: Input
    Name: SpectrumMin, Value: 1, Default?: Yes, Direction: Input
    Name: SpectrumMax, Value: 2147483647, Default?: Yes, Direction: Input
    Name: SpectrumList, Value: , Default?: Yes, Direction: Input
    Name: LoadMonitors, Value: Include, Default?: Yes, Direction: Input

  Algorithm: Plus   v1
  Execution Date: 2012-May-02 13:28:59
  Execution Duration: 0.002 seconds
  Parameters:
    Name: LHSWorkspace, Value: left, Default?: No, Direction: Input
    Name: RHSWorkspace, Value: right, Default?: No, Direction: Input
    Name: OutputWorkspace, Value: left, Default?: No, Direction: Output
    Name: AllowDifferentNumberSpectra, Value: 0, Default?: Yes, Direction: Input
    Name: ClearRHSWorkspace, Value: 0, Default?: Yes, Direction: Input

---------------------------------------------------------------------------
Wed 2. May 14:29:13 2012: Script execution finished.
---------------------------------------------------------------------------

comment:15 Changed 8 years ago by Martyn Gigg

  • Status changed from accepted to verify
  • Resolution set to fixed

comment:16 Changed 8 years ago by Peter Peterson

  • Status changed from verify to verifying

comment:17 Changed 8 years ago by Peter Peterson

  • Status changed from verifying to closed

Now it works perfectly.

comment:18 Changed 8 years ago by Martyn Gigg

Fix history recording in python algs. Refs #5158

If history is being recorded, the execution counted needs to be incremented.

Changeset: 897a24b7382e0f6faf08ccd90f125605f268172a

comment:19 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6004

Note: See TracTickets for help on using tickets.