Skip to content

Fix for running --sanity-check-only for a JuliaBundle#4122

Closed
Crivella wants to merge 3 commits into
easybuilders:developfrom
Crivella:fix-juliapackage_sanityonly
Closed

Fix for running --sanity-check-only for a JuliaBundle#4122
Crivella wants to merge 3 commits into
easybuilders:developfrom
Crivella:fix-juliapackage_sanityonly

Conversation

@Crivella

@Crivella Crivella commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Currently trying to run --sanity-check-only on a JuliaBundle-based EC fails due to the dependencies not being loaded when the main package is tested

  File "/home/crivella/Documents/GIT/easybuild-easyblocks/easybuild/easyblocks/generic/juliapackage.py", line 138, in julia_env_path
    julia_version = get_software_version('Julia').split('.')
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'split'

This in particular happens due to get_software_version('Julia') being called before the module is loaded

This PR adds same section as for PythonPackage to JuliaPackage to load module early

@Flamefire

Copy link
Copy Markdown
Contributor

I'm not sure this is the right place: PythonPackage does this because it uses the module-dependent stuff directly afterwards. https://github.com/Crivella/easybuild-easyblocks/blob/0c62eb9f874ae91a4b9dce397c3b225838569f52/easybuild/easyblocks/generic/pythonpackage.py#L1218

This isn't the case here.

Can you post the full traceback?

@Crivella

Copy link
Copy Markdown
Contributor Author

It is the same as in #4065 (comment)

The problem arise from

mod += self.module_generator.append_paths('JULIA_LOAD_PATH', [self.julia_env_path(absolute=False, base=False)])

where

julia_version = get_software_version('Julia').split('.')

is called before the Julia module is loaded making get_software_version('Julia') result in None and get_software_version('Julia').split('.') hence giving that exception

@Flamefire

Copy link
Copy Markdown
Contributor

I see, but this reasoning is not correct:

since custom actions taken below require that environment is set up properly already

The problem we have here: In order to create the module we need to load the module.
That is an entirely different issue and we should fix that instead.

The fix here works because for sanity-check-only the real module is loaded instead of creating one.
Another issue is that in ExtensionEasyBlock we use the fake module directly instead of sanity_check_module. The latter would load the real module as would the base easyblock

I have that fixed locally so I think I have an open PR for that. Looking for that or creating it.
Maybe we should try with that first as it is more general.

@Crivella

Copy link
Copy Markdown
Contributor Author

I guess if we want to be more specific we should load the only Julia module that should be available regardless beforehand

@Flamefire

Copy link
Copy Markdown
Contributor

What do you mean by that exactly?

I think we shouldn't do anything special. The current approach will work fine, if the sanity-check-only doesn't create a fake module.
And even with that we don't need to actually load the Julia module just to get the version: It should be a dependency of the easyconfig, so we can get it from there.

@Crivella

Crivella commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

I'd be careful of touching the ExtensionEasyblock.

Indeed we can take the version of Julia from the deps, the weird thing happening after is that in

--sanity-check-only, self.toolchain.deps from

https://github.com/easybuilders/easybuild-framework/blob/632d4d24ca91f19077aaa52c52020791d82596a3/easybuild/framework/easyblock.py#L1464

is not set, while self.cfg.dependencies() still gives the correct result.

This results in depends_on('Julia/XXX') not being in the fake module causing the first check to fail finding the Julia executable... 🤔

EDIT: i guess it comes down to the fact that we are skipping the prepare_step where this is being set

https://github.com/easybuilders/easybuild-framework/blob/632d4d24ca91f19077aaa52c52020791d82596a3/easybuild/framework/easyblock.py#L3054

@Crivella

Crivella commented Apr 30, 2026

Copy link
Copy Markdown
Contributor Author

While

is not required in general.
It is needed for an easyconfig that implements a sanity_check_command for the bundle such as

easyblock = 'JuliaBundle'
...

toolchain = SYSTEM

dependencies = [
    ('Julia', _julia_ver),
]

# Order is important as all dependencies of a package must be installed before the package itself
exts_list = [
    ....
]

sanity_check_commands = [
    f"julia -e 'using Pkg; Pkg.test(\"{name}\")'",
]

As Julia's module would not be loaded otherwise by the fake_module when testing.

@Flamefire
I think loading the existing module instead of the fake one could cause trouble in case of --module-only --rebuild in case changes to the Module are being made, but should be fine with --sanity-check-only (not sure if --module-only also sets the flags that would trigger the behavior of --sanity-check-only)

@Flamefire Flamefire left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM independent of other issues. Creating a module shouldn't depend on a module being loaded

@Crivella

Crivella commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Closing in favor of #4146 which includes these changes

@Crivella Crivella closed this Jun 5, 2026
@Crivella Crivella deleted the fix-juliapackage_sanityonly branch June 5, 2026 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants