-
Notifications
You must be signed in to change notification settings - Fork 40
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Config issues with custom Sandbox
#165
Comments
With 52fe3f9, config sections of sandboxes are not constructed dynamically any longer via The leading Alternatively you can set the class attribute class SingularityDevSandbox(law.singularity.SingularitySandbox):
config_section_prefix = "singularity_dev"
...
law.config.update({
"singularity_dev": {
"stagein_dir_name": "stagein",
"stageout_dir_name": "stageout",
"law_executable": "law",
},
"singularity_dev_env": {},
"singularity_dev_volumes": {},
}) under your class definition to register the minimal set of required options. |
This is great, thanks @riga ! |
@riga tried running with the latest commit, and regardless of whether I use my custom sandbox or not I'm getting the following error: Traceback (most recent call last):
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/bin/law", line 9, in <module>
from law.cli import run
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/__init__.py", line 46, in <module>
law.logger.setup_logging()
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/logger.py", line 43, in setup_logging
logger = setup_logger(logger, add_console_handler=False)
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/logger.py", line 107, in setup_logger
from law.config import Config
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 626, in <module>
locals()[name] = closure(name)
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 612, in closure
config = Config.instance()
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 167, in instance
cls._instance = cls(*args, **kwargs)
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 241, in __init__
include_configs(self.get_expanded("core", opt))
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 206, in include_configs
self.include(filename)
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 353, in include
p = self.__class__(filename, skip_defaults=True, skip_fallbacks=True, skip_env_sync=True,
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 241, in __init__
include_configs(self.get_expanded("core", opt))
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 444, in get_expanded
return self.get_default(*args, **kwargs)
File "/home/alec.gunny/miniconda3/envs/law-repro-DBCx7gBt-py3.9/lib/python3.9/site-packages/law/config.py", line 394, in get_default
value = self.get(section, option)
File "/home/alec.gunny/miniconda3/lib/python3.9/configparser.py", line 781, in get
d = self._unify_values(section, vars)
File "/home/alec.gunny/miniconda3/lib/python3.9/configparser.py", line 1149, in _unify_values
raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'core' Should I file a new issue for this? |
@alecgunny Sorry for that, this was a testing issue on my end. This should be fixed now with 500c1a8. |
Confirmed this is fully working now! |
Full reproducing code can be found here, this issue is concerned with issue 2 on that repo's README. In particular, trying to implement a custom
Sandbox
subclass causes issues at runtime with the Config looks for the corresponding section and finds it doesn't exist. Using the example above, if thesandbox_type
is called"singularity_dev"
, you might see something like:Haven't looked too much into how arguments get registered with the
Config
, but could this potentially be handled by a metaclass forSandbox
that automatically registers itsconfig_defaults
with the globalConfig
, maybe via astaticmethod
on the class being registered?The text was updated successfully, but these errors were encountered: