Ticket #5884 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

Fix running Python algorithm from other Python algorithm using simple API

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Release 2.3
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Owen Arnold

Description

The two algorithms below demonstrate the issue:

from mantid.api import PythonAlgorithm, registerAlgorithm
from mantid.simpleapi import *

class TestAlgorithm1(PythonAlgorithm):

    def PyInit(self):
        pass
    def PyExec(self):
        TestAlgorithm2()

registerAlgorithm(TestAlgorithm1)
from mantid.api import PythonAlgorithm, registerAlgorithm
from mantid.simpleapi import *

class TestAlgorithm2(PythonAlgorithm):

    def PyInit(self):
        pass
    def PyExec(self):
        print 'Algorithm2'

registerAlgorithm(TestAlgorithm2)

Save each to a file in the PythonAlgorithms directory, restart Mantid and run TestAlgorithm1. It will give an error about not being able to find TestAlgorithm2

Change History

comment:1 Changed 8 years ago by Martyn Gigg

Allow Python alg to use another Python alg with simple API. Refs #5884

This has been applied to both APIs as there are still quite a few old API algorithms.

Changeset: ce7307ca8245b3947b6d599aa4aed214eef77e5b

comment:2 Changed 8 years ago by Martyn Gigg

Fix clashing file names in tests. Refs #5884

Only shows an issue when running the tests in parallel.

Changeset: 8c0f667aed97f238152bdbf3bda83471e6a486be

comment:3 Changed 8 years ago by Martyn Gigg

Fix Windows Python tests. Refs #5884

The working directory was set to bin rather than bin/[configuration]

Changeset: 0548d78634b446402b604d367b30319c85e288e1

comment:4 Changed 8 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:5 Changed 8 years ago by Martyn Gigg

Bring Squares.py example up to date with new API. Refs #5884

Changeset: d61e9d4e10e2ca7f07765ca40bff113a141da89b

comment:6 Changed 8 years ago by Martyn Gigg

Tidyup of plugin loading. Refs #5884

Ensures that the filesystem is traversed only once when creating the simple API functions for the Python algorithms

Changeset: c0be74e391bc6659a7481512e2ab3d198d498338

comment:7 Changed 8 years ago by Martyn Gigg

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

comment:8 Changed 8 years ago by Owen Arnold

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

comment:9 Changed 8 years ago by Owen Arnold

  • Status changed from verifying to closed

This doesn't fail. Now seems to find TestAlgorithm2.

comment:10 Changed 8 years ago by Martyn Gigg

Allow Python alg to use another Python alg with simple API. Refs #5884

This has been applied to both APIs as there are still quite a few old API algorithms.

Changeset: ce7307ca8245b3947b6d599aa4aed214eef77e5b

comment:11 Changed 8 years ago by Martyn Gigg

Fix clashing file names in tests. Refs #5884

Only shows an issue when running the tests in parallel.

Changeset: 8c0f667aed97f238152bdbf3bda83471e6a486be

comment:12 Changed 8 years ago by Martyn Gigg

Fix Windows Python tests. Refs #5884

The working directory was set to bin rather than bin/[configuration]

Changeset: 0548d78634b446402b604d367b30319c85e288e1

comment:13 Changed 8 years ago by Martyn Gigg

Bring Squares.py example up to date with new API. Refs #5884

Changeset: d61e9d4e10e2ca7f07765ca40bff113a141da89b

comment:14 Changed 8 years ago by Martyn Gigg

Tidyup of plugin loading. Refs #5884

Ensures that the filesystem is traversed only once when creating the simple API functions for the Python algorithms

Changeset: c0be74e391bc6659a7481512e2ab3d198d498338

comment:15 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6730

Note: See TracTickets for help on using tickets.