easybuilders / easybuild-easyblocks

Collection of easyblocks that implement support for building and installing software with EasyBuild.
https://easybuild.io
GNU General Public License v2.0
106 stars 285 forks source link

fix double initialization of `Cargo` by `CargoPythonPackage` by removing incorrect custom `__init__` implementation + fix use of `super()` in PALM easyblock (since that doesn't work with Python 2.7) #3406

Closed Flamefire closed 3 months ago

Flamefire commented 3 months ago

The issue intended to be fixed with #2934 is actually (likely) caused by Pythons MRO:

CargoPythonPackage explicitely calls __init__ of both Cargo and PythonPackage

  1. super().__init__ in Cargo calls ExtensionEasyBlock->EasyBlock stop (Could then call Extension but ExtensionEasyBlock does not usesuper`)
  2. Then PythonPackage.__init__ is called by CargoPythonPackage
  3. super().__init__ in PythonPackage calls Cargo.__init__ again(!)
  4. Then all other methods are called again as per 1.

The MRO order is [CargoPythonPackage, PythonPackage, Cargo, ExtensionEasyBlock, EasyBlock, Extension] which explains that.

Fix is to consistently use super() in the CargoPythonPackage inheritance chain.

Flamefire commented 3 months ago

Please have a look at this @boegel @Micket (involved in #2934)

Related easyconfig PR: https://github.com/easybuilders/easybuild-easyconfigs/pull/21143

Flamefire commented 3 months ago

As discussed in the confcall I made that compatible with Python 2 which doesn't support argument-less super()

I found another instance of that in Palm and an __init__ which did nothing and could be removed, see https://pylint.readthedocs.io/en/latest/user_guide/messages/warning/useless-parent-delegation.html

boegel commented 3 months ago

@boegelbot please test @ jsc-zen3 EB_ARGS="maturin-1.1.0-GCCcore-12.3.0.eb"

boegelbot commented 3 months ago

@boegel: Request for testing this PR well received on jsczen3l1.int.jsc-zen3.fz-juelich.de

PR test command 'if [[ develop != 'develop' ]]; then EB_BRANCH=develop ./easybuild_develop.sh 2> /dev/null 1>&2; EB_PREFIX=/home/boegelbot/easybuild/develop source init_env_easybuild_develop.sh; fi; EB_PR=3406 EB_ARGS="maturin-1.1.0-GCCcore-12.3.0.eb" EB_REPO=easybuild-easyblocks EB_BRANCH=develop /opt/software/slurm/bin/sbatch --job-name test_PR_3406 --ntasks=8 ~/boegelbot/eb_from_pr_upload_jsc-zen3.sh' executed!

Test results coming soon (I hope)...

*- notification for comment with ID 2288342661 processed* *Message to humans: this is just bookkeeping information for me, it is of no use to you (unless you think I have a bug, which I don't).*
boegelbot commented 3 months ago

Test report by @boegelbot

Overview of tested easyconfigs (in order)

Build succeeded for 1 out of 1 (1 easyconfigs in total) jsczen3c1.int.jsc-zen3.fz-juelich.de - Linux Rocky Linux 9.4, x86_64, AMD EPYC-Milan Processor (zen3), Python 3.9.18 See https://gist.github.com/boegelbot/0564556181cc9483d3b637caf21d0ba0 for a full test report.