Project

General

Profile

Feature #1201

Modifying Global configuration values from the testing frame work

Added by Dobbs, Adam over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Tracker
Target version:
Start date:
04 January 2013
Due date:
% Done:

100%

Estimated time:
Workflow:
Awaiting Merge

Description

The tracker group has just moved to using the new GlobalManager for importing configuration data. It works well, except from within the testing framework. From python it seems its no longer possible to modify an individual configuration parameter, for example changing the geometry, or switching between helical and straight reconstruction between tests. Additionally, running tests individually using python, such as:

python src/map/MapCppTrackerRecon/test_MapCppTrackerRecon.py

no longer necessarily produces the same result a test will when run as part of unit_tests.sh, as this latter seems to load a configuration of its own which cannot be overridden.

Have been trying to work around to restore some test functionality after a trunk merge, but it really needs to be tackled at MAUS level I think. A module for python which allows modification of Global values would solve the problem (or does this already exist?)

Thanks!

#1

Updated by Dobbs, Adam over 8 years ago

Addendum. Using

import maus_cpp.globals

...

if maus_cpp.globals.has_instance():
    maus_cpp.globals.death()

...

will solve the problem for a particular test, allowing individual configuration data to be changed after it is called. However, as this wipes out the entire set of globals in order to change just a select set of parameters, it leads to other tests failures in unrelated tests, such as,

======================================================================
ERROR: Test maus_cpp.Field.get_field_value(...)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/vols/mice3/adobbs/maus/tracker_devel/build/test_maus_cpp/test_field.py", line 43, in test_get_field_value
maus_cpp.globals.birth(self.config)
RuntimeError: Attempt to initialise Globals when it was already initialised at GlobalsManager::InitialiseGlobals

======================================================================

======================================================================
FAIL: Test maus_cpp.globals.birth() and maus_cpp.globals.death()
----------------------------------------------------------------------
Traceback (most recent call last):
File "/vols/mice3/adobbs/maus/tracker_devel/build/test_maus_cpp/test_globals.py", line 42, in test_birth
self.assertRaises(RuntimeError, maus_cpp.globals.death, ())
AssertionError: RuntimeError not raised


#2

Updated by Rogers, Chris over 8 years ago

  • Assignee changed from Rogers, Chris to Dobbs, Adam
  • Workflow changed from New Issue to Awaiting Merge

A new method was added to globals, get_configuration_cards, which returns a json string representation of the data cards. This enables user to do

default_cards = "" 
if maus_cpp.globals.has_instance():
    default_cards = maus_cpp.globals.get_configuration_cards()
    maus_cpp.globals.death()

maus_cpp.globals.birth(my_cards)
<run the tests>
...
...
if maus_cpp.globals,has_instance():
    maus_cpp.globals.death()
if default_cards != "":
    maus_cpp.globals.birth(default_cards)

This is on Adam Dobbs's codebase currently... I will let him merge it (and then close the issue).

#3

Updated by Dobbs, Adam over 8 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Merged and pushed back to trunk. Closing the issue.

#4

Updated by Rogers, Chris over 8 years ago

  • Target version changed from Future MAUS release to MAUS-v0.4.3

Also available in: Atom PDF