Skip to content
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

--include-easyblocks[-from-pr] fails for multiple easyblocks related by inheritance #3779

Closed
Flamefire opened this issue Jul 19, 2021 · 2 comments · Fixed by #3780
Closed
Milestone

Comments

@Flamefire
Copy link
Contributor

I recently updated PythonPackage and TensorFlow easyblocks in one PR and tried to submit test reports but it failed:

File "/home/h3/s3248973/.local/EasyBuildDev/easybuild-framework/easybuild/main.py", line 118, in build_and_install_software
(ec_res['success'], app_log, err) = build_and_install_one(ec, init_env)
File "/home/s3248973/.local/EasyBuildDev/easybuild-framework/easybuild/framework/easyblock.py", line 3697, in build_and_install_one
result = app.run_all_steps(run_test_cases=run_test_cases)
File "/home/s3248973/.local/EasyBuildDev/easybuild-framework/easybuild/framework/easyblock.py", line 3585, in run_all_steps
self.run_step(step_name, step_methods)
File "/home/s3248973/.local/EasyBuildDev/easybuild-framework/easybuild/framework/easyblock.py", line 3438, in run_step
step_method(self)()
File "/home/s3248973/.local/EasyBuildDev/easybuild-easyblocks/easybuild/easyblocks/generic/pythonbundle.py", line 128, in extensions_step
super(PythonBundle, self).extensions_step(*args, **kwargs)
File "/home/s3248973/.local/EasyBuildDev/easybuild-framework/easybuild/framework/easyblock.py", line 2402, in extensions_step
self.init_ext_instances()
File "/home/s3248973/.local/EasyBuildDev/easybuild-framework/easybuild/framework/easyblock.py", line 2332, in init_ext_instances
inst = cls(self, ext)
File "/tmp/easybuild-tmp/included-easyblocks-iBqB1u/easybuild/easyblocks/tensorflow.py", line 239, in init
super(EB_TensorFlow, self).init(*args, **kwargs)
File "/tmp/easybuild-tmp/included-easyblocks-iBqB1u/easybuild/easyblocks/generic/pythonpackage.py", line 278, in init
super(PythonPackage, self).init(*args, **kwargs)
TypeError: must be type, not None

It seems that PythonPackage turns out as None which I can't really explain. Splitting up the PR into 1 easyblock each seemingly works. See easybuilders/easybuild-easyblocks#2516

@migueldiascosta
Copy link
Member

migueldiascosta commented Jul 19, 2021

@Flamefire I think (or maybe hope) we can narrow this down a bit

My guess is that this bug is specific to the case where the included easyblocks are related by inheritance and possibly with the fact that we are still (even after #3544) messing with sys.modules at

# force re-import if the specified modules was already imported;
# this is required to ensure that an easyblock that is included via --include-easyblocks-from-pr
# gets preference over one that is included via --include-easyblocks
if pymod_spec in sys.modules:
del sys.modules[pymod_spec]
try:
pymod = __import__(pymod_spec, fromlist=[pypkg])
(i.e., we reimport PythonPackage as a new object, but we deleted the PythonPackage object that was the super class of TensorFlow (?) )

@migueldiascosta migueldiascosta added this to the next release (4.4.2?) milestone Jul 19, 2021
Flamefire added a commit to Flamefire/easybuild-framework that referenced this issue Jul 19, 2021
Flamefire added a commit to Flamefire/easybuild-framework that referenced this issue Jul 19, 2021
Avoids errors on on Python2 when we delete a subclass after importing
a module with a class depending on it.
Fixes easybuilders#3779
@Flamefire
Copy link
Contributor Author

I get the same error if I try to --include-easyblocks=*.py with local copies of pythonpackage.py and tensorflow.py (can you check?)

Looks like you are absolutely correct. Same here, and fix created changing the mentioned code. Also added a reproducer test. It's a bit involved and only happens in Python 2 as far as I can tell

Flamefire added a commit to Flamefire/easybuild-framework that referenced this issue Jul 28, 2021
Flamefire added a commit to Flamefire/easybuild-framework that referenced this issue Jul 28, 2021
Avoids errors on on Python2 when we delete a subclass after importing
a module with a class depending on it.
Fixes easybuilders#3779
@migueldiascosta migueldiascosta changed the title --include-easyblocks-from-pr fails for multiple easyblocks --include-easyblocks[-from-pr] fails for multiple easyblocks related by inheritance Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants