Ticket #2635 (closed: fixed)

Opened 10 years ago

Last modified 5 years ago

Allow an algorithm to be passed as a parameter

Reported by: Nick Draper Owned by: Martyn Gigg
Priority: critical Milestone: Iteration 28
Component: Mantid Keywords:
Cc: doucetm@… Blocked By:
Blocking: Tester: Janik Zikovsky

Description

Allow an algorithmproxy to be passed as a parameter.

This would allow the algorithm to be run by the host Algorithm.

Steps:

  1. Make AlgorithmProxy able to de/serialise to a string together with any parameters.
  2. Create an AlgorithmProperty class that handles IAlgorithms
  3. Create a AlgorithmHasParameter Validator
  4. Create an AlgorithmInheritsFrom Validator
  5. Write a few tests.

Change History

comment:1 Changed 10 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 10 years ago by Martyn Gigg

(In [10434]) Refs #2635. Algorithms can now stringize themselves and also construct themselves from a string. The format is AlgorithmName[.v](prop1=val1,prop2=val2,...), where the .v is optional and determines the version. Added convenience methods on the property manager to stringize itself as well.

comment:3 Changed 10 years ago by Martyn Gigg

(In [10435]) Refs #2635. Fix build failure on Linux/Mac.

comment:4 Changed 10 years ago by Martyn Gigg

(In [10457]) Refs #2635. Added AlgorithmProperty class plus a AlgorithmHasProperty validator and some tests. This will allow algorithm objects to be passed in to other algorithms as properties.

comment:5 Changed 10 years ago by Martyn Gigg

(In [10460]) Refs #2635. Add str to the IAlgorithm python export and remove a trailing comma from the Property::toString output.

comment:6 Changed 10 years ago by Martyn Gigg

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

I'm spinning point 4, "Create an AlgorithmInheritsFrom Validator", out to another ticket, #2746. It's not as simple as it sounds and not vital to this ticket being completed.

The AlgorithmProperty is in and Python can stringize algorithm objects so the bulk is done.

comment:7 Changed 10 years ago by Mathieu Doucet

  • Status changed from verify to reopened
  • Resolution fixed deleted

Note: we should expose the AlgorithmProperty to Python so they can be used in Python Algorithms.

comment:8 Changed 10 years ago by Martyn Gigg

(In [10572]) Refs #2635. Allow AlgorithmProperty to work in the same way as the other properties, i.e can use .name and .value on it. Ten lines of code that I should have put in last week, sorry Mathieu!

comment:9 Changed 10 years ago by Mathieu Doucet

One thing to make sure of is that the AlgorithmProperty can accept an PythonAlgorithm. I don't think that's the case right now...

comment:10 Changed 10 years ago by Mathieu Doucet

(In [10619]) Add declare, set and get for AlgorithmProperty for PyAlgorithmBase. Added related tests. Re #2635

comment:11 Changed 10 years ago by Mathieu Doucet

I think we are set. Note that the python API will only allow the PythonAlgorithm class to set/get algorithm properties. Algorithm properties get/setters are not exposed for C++ algorithms. This would only be useful for reduction step algorithms written in C++.

comment:12 Changed 10 years ago by Mathieu Doucet

(In [10626]) Fix test. Re #2635

comment:13 Changed 10 years ago by Mathieu Doucet

(In [10631]) Simplify the public API for AlgorithmProperty. Re #2635

comment:14 Changed 10 years ago by Mathieu Doucet

(In [10634]) Cleaning up. Re #2635

comment:15 Changed 9 years ago by Martyn Gigg

  • Status changed from reopened to accepted

comment:16 Changed 9 years ago by Martyn Gigg

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

comment:17 Changed 9 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:18 Changed 9 years ago by Owen Arnold

  • Status changed from verifying to verify
  • Tester Owen Arnold deleted

comment:19 Changed 9 years ago by Janik Zikovsky

  • Status changed from verify to verifying
  • Tester set to Janik Zikovsky

comment:20 Changed 9 years ago by Janik Zikovsky

(In [11128]) Refs #2635: Added a python unit test where an algorithm property is obtained in a Python algo and then executed.

comment:21 Changed 9 years ago by Janik Zikovsky

  • Status changed from verifying to closed

The unit test I added satisfies me that you can also execute an algorithm property, not just get/set the property. Passes.

comment:22 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 3482

Note: See TracTickets for help on using tickets.