Ticket #2270 (closed: fixed)
Algorithms called from a Python Algorithm should not log themselves in history
Reported by: | Mathieu Doucet | Owned by: | Mathieu Doucet |
---|---|---|---|
Priority: | major | Milestone: | Iteration 27 |
Component: | Python | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Martyn Gigg |
Description
Sub-algorithms called from a C++ algorithm don't log themselves into the workspace history. Algorithms called from python algorithms do. There should be a way to turn that off so that only the calling algorithm is logged. The calling algorithm is currently not logged.
Change History
comment:1 Changed 10 years ago by Mathieu Doucet
- Owner set to Mathieu Doucet
- Status changed from new to accepted
comment:8 Changed 10 years ago by Mathieu Doucet
- Status changed from accepted to verify
- Resolution set to fixed
PythonAlgorithms can now execute a sub-algo that will behave like those called from a C++ Algorithm (among other things, they won't log themselves). Private methods have been added to transfer ownership of the intermediate workspaces. Those could eventually go away if we add the functionality to get/set Algorithm properties in their correct type instead of using strings.
Example code from PythonAlgorithm.PyExec:
a = self.executeSubAlg(CreateWorkspace, OutputWorkspace=output_ws, DataX=[0,1,2], DataY=[0,1,2], DataE=[0,0,0]) self._setWorkspaceProperty("OutputWorkspace", a._getWorkspaceProperty("OutputWorkspace"))
See test/PythonAlgorithmTest.py for unit tests.
comment:10 Changed 10 years ago by Mathieu Doucet
comment:11 Changed 10 years ago by Mathieu Doucet
comment:12 Changed 10 years ago by Mathieu Doucet
comment:13 Changed 10 years ago by Mathieu Doucet
comment:14 Changed 10 years ago by Mathieu Doucet
comment:15 Changed 10 years ago by Mathieu Doucet
comment:16 Changed 10 years ago by Martyn Gigg
- Status changed from verify to verifying
- Tester set to Martyn Gigg
comment:17 Changed 10 years ago by Martyn Gigg
- Status changed from verifying to closed
Tested in 1.1.9533
Tested with
class SubAlgTest(PythonAlgorithm): def PyInit(self): self.declareProperty("Value",1,Direction=Direction.Input) self.declareWorkspaceProperty("OutputWorkspace","",Direction=Direction.Output) def PyExec(self): value = self.getProperty("Value") child = self.executeSubAlg(CreateWorkspace,DataX=[value],DataY=[value],DataE=[value]) self.setProperty("OutputWorkspace", child._getWorkspaceProperty("OutputWorkspace")) mtd.registerPyAlgorithm(SubAlgTest())
Verified that CreateWorkspace did not log or store it's workspace in the ADS.
comment:18 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 3117