-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Utility functions located in wrong place #2128
Comments
Please include code as text (not image) as well and boil the example down to the absolute minimal. The problem comes already from line 2, so presumably everything below there is irrelevant. Also you can probably reduce the number of imports in line 2, to the minimal tha t will still show the failure. |
Understood. I'll edit it to make sure it's compliant. |
Here with the error included. Why we get the identical In [1]: import ganga.ganga
INFO reading config file /home/egede/.gangarc
INFO reading config file /home/egede/.gangarc
INFO reading config file /home/egede/.gangarc
INFO reading config file /home/egede/.gangarc
INFO reading config file /home/egede/.gangarc
In [2]: from ganga.GangaTest.Framework.utils import sleep_until_completed
---------------------------------------------------------------------------
ConfigError Traceback (most recent call last)
Input In [2], in <module>
----> 1 from ganga.GangaTest.Framework.utils import sleep_until_completed
File ~/programming/ganga/ganga/ganga/GangaTest/Framework/__init__.py:1, in <module>
----> 1 import GangaTest.Framework.runner
File ~/programming/ganga/ganga/ganga/GangaTest/Framework/__init__.py:1, in <module>
----> 1 import GangaTest.Framework.runner
File ~/programming/ganga/ganga/ganga/GangaTest/Framework/runner.py:42, in <module>
39 gangaReleaseTopDir = previous_dir(myFullPath, 3)
41 # testing framework configuration properties
---> 42 myConfig = makeConfig('TestingFramework', 'Configuration section for internal testing framework')
44 # Release testing mode:
45 # - xml/html reports are generated
46 # - coverage analysis tool enabled
47 myConfig.addOption('ReleaseTesting', False, '')
File ~/programming/ganga/ganga/ganga/GangaCore/Utility/Config/Config.py:188, in makeConfig(name, docstring, **kwds)
183 """
184 Create a config package and attach metadata to it. makeConfig() should be called once for each package.
185 """
187 if _after_bootstrap:
--> 188 raise ConfigError('attempt to create a configuration section [%s] after bootstrap' % name)
190 try:
191 c = allConfigs[name]
ConfigError: ConfigError: attempt to create a configuration section [TestingFramework] after bootstrap
|
We obviously execute the line GangaCore/Utility/Config/Config.py: logger.info('reading config file %s', f) five times during the bootstrap. Seems like an overkill. The best way of dealing with the bug here might just be to allow the configuration to be updated after bootstrap. What harm would it do? |
I would say this is a bug rather than overkill. It's been a long time since I worked on this code in anger but I recall that it only read this file once and then would read another file if for example you specified a different config. We should figure out why it's being read 5 times. I will see if I get the same behaviour. edit: I've just realised that this is from importing ganga with in an interactive session rather than starting gange standalone. I was referring to ganga standalone. In any case I would expect the behaviour to be the same so we should figure out what the difference is |
I think one needs to be careful - we set up the config with a priority depending on where options are specified, i.e. |
The issue of the repeated reading of the |
The issue In [1]: import ganga.ganga
In [2]: from ganga.GangaTest.Framework.utils import sleep_until_completed
---------------------------------------------------------------------------
ConfigError Traceback (most recent call last) is not a bug as such. The config system is static in structure after the import of Ganga in [1]. However, error message should be improved (should be a A way to solve the specific problem here is actually to move the utility function |
There seems to be a config error when one tries to import multiple modules from Ganga.
#Steps to reproduce
import ganga.ganga
from ganga.GangaTest.Framework.utils import sleep_until_completed
#Reason
The reasoning that seemed reasonable was that ganga is engaging bootloaders when we import it for the first time. So, when we use a second import, it throws a config error
The text was updated successfully, but these errors were encountered: