Skip to content

fix logging in ExtensionEasyblock.extra_options#893

Merged
boegel merged 5 commits intoeasybuilders:developfrom
boegel:fix_extensioneasyblock_logging
Mar 25, 2014
Merged

fix logging in ExtensionEasyblock.extra_options#893
boegel merged 5 commits intoeasybuilders:developfrom
boegel:fix_extensioneasyblock_logging

Conversation

@boegel
Copy link
Copy Markdown
Member

@boegel boegel commented Mar 25, 2014

No description provided.

@boegel boegel added this to the v1.12 milestone Mar 25, 2014
@stdweird
Copy link
Copy Markdown
Contributor

ok

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Mar 25, 2014

@stdweird: extended unit tests and added more debug logging, please recheck?

@stdweird
Copy link
Copy Markdown
Contributor

still ok ;)

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Mar 25, 2014

@stdweird: I found out that make EasyBlock.extra_options() returns a dict rather than a list of tuples is breaking the backwards compatibility of the API.
Existing easyblocks that work and define custom extra easyconfig parameters via extra_options may no longer work. Example (from the CMakeMake easyblock in EasyBuild v1.11):

    @staticmethod
    def extra_options(extra_vars=None):
        """Define extra easyconfig parameters specific to CMakeMake."""

        orig_vars = ConfigureMake.extra_options(extra_vars)
        cmakemake_vars = [
            ('srcdir', [None, "Source directory location to provide to cmake command", CUSTOM]),
            ('separate_build_dir', [False, "Perform build in a separate directory", CUSTOM]),
        ]
        cmakemake_vars.extend(orig_vars)
        return cmakemake_vars

Here, the dict result of the extra_options call to ConfigureMake (which in turns will obtain the result from EasyBlock.extra_options()) is used to extend a list of tuples.

What's worse, rather than barf with a clear error message, the extend actually kind of works, and (in the above case), yields a list like:

[
    ('srcdir', [None, "Source directory location to provide to cmake command", CUSTOM]),
    ('separate_build_dir', [False, "Perform build in a separate directory", CUSTOM]),
    'prefix_opt',
    'tar_config_opts',
]

and then you get a funky error message like:

== 2014-03-25 13:59:19,465 main.easyblock.<module> DEBUG Converting extra_options value '[('tar_config_opts', [False, 'Override tar settings as determined by configure.', (1, 'easyblock-specific')]), ('prefix_opt', ['--prefix=', 'Prefix command line option for configure script', (1, 'easyblock-specific')])]' of type '<type 'list'>' to a dict
== 2014-03-25 13:59:19,466 main.EasyConfig WARNING Deprecated functionality, will no longer work in v2.0: Specified extra_options should be of type 'dict', found type '<type 'list'>'
== 2014-03-25 13:59:19,466 main.EasyConfig DEBUG Converting extra_options value '[('srcdir', [None, 'Source directory location to provide to cmake command', (1, 'easyblock-specific')]), ('separate_build_dir', [False, 'Perform build in a separate directory', (1, 'easyblock-specific')]), 'prefix_opt', 'tar_config_opts']' of type '<type 'list'>' to a dict
Traceback (most recent call last):
  File "/user/home/gent/vsc400/vsc40003/easybuild_easyinstalled/lib/python2.6/site-packages/easybuild_framework-1.12.0dev-py2.6.egg/easybuild/main.py", line 362, in <module>
    main()
  File "/user/home/gent/vsc400/vsc40003/easybuild_easyinstalled/lib/python2.6/site-packages/easybuild_framework-1.12.0dev-py2.6.egg/easybuild/main.py", line 293, in main
    ordered_ecs = resolve_dependencies(easyconfigs, build_specs=build_specs)
  File "/user/home/gent/vsc400/vsc40003/easybuild_easyinstalled/lib/python2.6/site-packages/easybuild_framework-1.12.0dev-py2.6.egg/easybuild/framework/easyconfig/tools.py", line 435, in resolve_dependencies
    processed_ecs = process_easyconfig(path, build_specs=build_specs, validate=not retain_all_deps)
  File "/user/home/gent/vsc400/vsc40003/easybuild_easyinstalled/lib/python2.6/site-packages/easybuild_framework-1.12.0dev-py2.6.egg/easybuild/framework/easyconfig/tools.py", line 259, in process_easyconfig
    ec = EasyConfig(spec, build_specs=build_specs, validate=validate)
  File "/user/home/gent/vsc400/vsc40003/easybuild_easyinstalled/lib/python2.6/site-packages/easybuild_framework-1.12.0dev-py2.6.egg/easybuild/framework/easyconfig/easyconfig.py", line 117, in __init__
    self.extra_options = dict(self.extra_options)
ValueError: dictionary update sequence element #2 has length 10; 2 is required

Right now, I don't know if or how we can remedy this, so we might need to roll back making EasyBlock.extra_options returns a dict... Thoughts?

@boegel
Copy link
Copy Markdown
Member Author

boegel commented Mar 25, 2014

@stdweird: let's handle that last remark in a separate PR.

boegel added a commit that referenced this pull request Mar 25, 2014
fix logging in ExtensionEasyblock.extra_options
@boegel boegel merged commit d255bb9 into easybuilders:develop Mar 25, 2014
@boegel boegel deleted the fix_extensioneasyblock_logging branch March 25, 2014 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants