You could use aliases instead of functions, but that won't solve the issue.
You can use scripts, but you have to source them (or they won't modify the running shell's environment).
What you need is to have the modules environment initialized as part of the job startup.
This should be easily done by sourcing one file that sets up (like a login script) the job environment, including running the module initialization commands.
Think of it like starting an ssh session (it does not inherit any of the environment from the process that submits the job, the environment has to be completely set up in the job).
On 2025-02-06 3:18 PM, Frank Thommen wrote:
> Dear all,
>
> is there a way to use (shell) scripts instead of shell functions for all the required Environment Modules functionalities?
>
> In our cluster, shell functions are currently not inherited by cluster jobs from the users' local environments, leading to a non-functional (better: non-existent) `module` command within the batch jobs, which breaks many of our established pipelines. I considered to implement the required shell functions as plain shell scripts, but in contrast to Environment Modules 3.x, where there was just a single shell function, there is now a loooong list of functions. Implementing them all as scripts would require to check each of them after each Environment Module upgrade, to be sure to always use up-to-date code. That's too much overhead on the admin side.
>
> Question: Is there way to convert the shell functions into scripts, which does not conflict with the Environment Modules' design and which could also be integrated into automated Environment Modules updates (Debian Linux using `apt`)?
>
> Side question: Why are the Environment Modules' functions implemented as shell functions instead of plain shell scripts?
>
> I'm grateful for all ideas and pointers.
>
> Cheers, Frank
>
>
> _______________________________________________
> Modules-interest mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/modules-interest
--
--------------------------------------------------------
The views and opinions expressed above are strictly
those of the author(s). The content of this message has
not been reviewed nor approved by any entity whatsoever.
--------------------------------------------------------
Paul FM Info: http://paulfm.com/~paulfm/
--------------------------------------------------------
|