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

Warning no version #55

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 2 additions & 103 deletions lmod/SitePackage.lua
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ dofile(pathJoin(lmod_package_path,"SitePackage_families.lua"))
dofile(pathJoin(lmod_package_path,"SitePackage_properties.lua"))
dofile(pathJoin(lmod_package_path,"SitePackage_visible.lua"))
dofile(pathJoin(lmod_package_path,"SitePackage_localpaths.lua"))
dofile(pathJoin(lmod_package_path,"SitePackage_warnings.lua"))

sandbox_registration{ loadfile = loadfile, assert = assert, loaded_modules = loaded_modules, serializeTbl = serializeTbl, clearWarningFlag = clearWarningFlag }
require("strict")
Expand Down Expand Up @@ -271,109 +272,6 @@ function cuda_driver_library_available(cuda_version_two_digits)
end
sandbox_registration{ cuda_driver_library_available = cuda_driver_library_available }

local function intel_old_stack_warning(t)
local moduleName = myModuleName()
-- only go further for intel
if (moduleName ~= "intel") then return end
local vendor_cpu_id = os.getenv("RSNT_CPU_VENDOR_ID") or get_cpu_vendor_id()
if vendor_cpu_id == "amd" then
local myFileName = myFileName()
if string.match(myFileName, "/cvmfs/soft.computecanada.ca/easybuild/modules/2017/Core") then
local lang = os.getenv("LANG") or "en"
if (string.sub(lang,1,2) == "fr") then
LmodWarning([[Vous tentez de charger le module d'un compilateur intel sur un ordinateur doté de processeurs AMD.
Les logiciels compilés à l'aide des compilateurs Intel dans les environnements standard StdEnv/2016.4 et StdEnv/2018.3 ne sont pas
compatibles avec les processeurs AMD. Veuillez plutôt charger l'environnement StdEnv/2020 et un compilateur plus récent.
]])
else
LmodWarning([[You are attempting to load the intel compiler on a computer equiped with AMD processors.
Software compiled with the Intel compiler in the standard environments StdEnv/2016.4 and StdEnv/2018.3 are not compatible
with AMD processors. Please instead use the StdEnv/2020 standard environment and a more recent compiler.
]])
end
end
end
end
local function default_module_change_warning(t)
local moduleName = myModuleName()

-- only go further for StdEnv
if (moduleName ~= "StdEnv" and moduleName ~= "python") then return end
-- allow to completely disable the upcoming transition
local enableStdEnv2020Transition = os.getenv("RSNT_ENABLE_STDENV2020_TRANSITION") or "unknown"
if (enableStdEnv2020Transition == "unknown") then
-- Niagara sets the variable locally
local cccluster = os.getenv("CC_CLUSTER") or "computecanada"
if (cccluster == "cedar" or cccluster == "graham" or cccluster == "beluga") then
enableStdEnv2020Transition = "yes"
else
enableStdEnv2020Transition = "no"
end
end
if (enableStdEnv2020Transition == "no") then return end

local FrameStk = require("FrameStk")
local frameStk = FrameStk:singleton()
local userProvidedName = frameStk:userName()
local moduleFullName = t.modFullName
-- do not go further if the user provided the name with the version
if (userProvidedName == moduleFullName) then return end

local moduleVersion = myModuleVersion()
local defaultKind
if convertToCanonical(LmodVersion()) >= convertToCanonical("8.4.20") then
defaultKind = t.mname:defaultKind()
else
defaultKind = "unknown" -- before 8.4.20, we can not detect if the default comes from the user, so we display the warning regardless
end

local lang = os.getenv("LANG") or "en"

-- only show the warning if the user provided "StdEnv" as load, if the defaultKind is system, and if it does not result in 2020
if (userProvidedName == "StdEnv" and moduleVersion ~= "2020" and (defaultKind == "system" or defaultKind == "unknown")) then
--color_banner("red")
if (string.sub(lang,1,2) == "fr") then
LmodWarning([[Attention, le 1er avril 2021, la version par défaut de l'environnement standard sera mise à jour.
Pour tester vos tâches avec le nouvel environnement, exécutez la commande :
module load StdEnv/2020

Pour changer votre version par défaut immédiatement, exécutez la commande suivante :

echo "module-version StdEnv/2020 default" >> $HOME/.modulerc

Pour davantage d'information, visitez :
https://docs.computecanada.ca/wiki/Standard_software_environments/fr]])
else
LmodWarning([[Warning, April 1st 2021, the default standard environment module will be changed to a more recent one.
To test your jobs with the new environment, please run:
module load StdEnv/2020

To change your default version immediately, please run the following command:

echo "module-version StdEnv/2020 default" >> $HOME/.modulerc

For more information, please see:
https://docs.computecanada.ca/wiki/Standard_software_environments]])
end
--color_banner("red")
end

-- only show the warning if the user provided a shortened version of python as load, if the defaultKind is system or marked, and if it does not result in 3.10.2
if (userProvidedName == "python" or userProvidedName == "python/3" or userProvidedName == "python/3.") then
if (moduleVersion ~= "3.10.2" and (defaultKind == "system" or defaultKind == "unknown" or defaultKind == "marked")) then
if (string.sub(lang,1,2) == "fr") then
LmodWarning([[Attention, le 4 avril 2023, la version par défaut de python deviendra 3.10.
Pour continuer d'utiliser la version 3.8, veuillez charger le module python/3.8 explicitement.
]])
else
LmodWarning([[Warning. On April 4th 2023, the default version of python will become 3.10.
To keep using python 3.8, please load the python/3.8 module explicitly.
]])
end
end
--color_banner("red")
end
end
local function unload_hook(t)
set_family(t)
set_local_paths(t)
Expand All @@ -382,6 +280,7 @@ local function load_hook(t)
local valid = validate_license(t)
set_props(t)
set_family(t)
incomplete_version_warning(t)
default_module_change_warning(t)
intel_old_stack_warning(t)
log_module_load(t,true)
Expand Down
141 changes: 141 additions & 0 deletions lmod/SitePackage_warnings.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
function intel_old_stack_warning(t)
local moduleName = myModuleName()
-- only go further for intel
if (moduleName ~= "intel") then return end
local vendor_cpu_id = os.getenv("RSNT_CPU_VENDOR_ID") or get_cpu_vendor_id()
if vendor_cpu_id == "amd" then
local myFileName = myFileName()
if string.match(myFileName, "/cvmfs/soft.computecanada.ca/easybuild/modules/2017/Core") then
local lang = os.getenv("LANG") or "en"
if (string.sub(lang,1,2) == "fr") then
LmodWarning([[Vous tentez de charger le module d'un compilateur intel sur un ordinateur doté de processeurs AMD.
Les logiciels compilés à l'aide des compilateurs Intel dans les environnements standard StdEnv/2016.4 et StdEnv/2018.3 ne sont pas
compatibles avec les processeurs AMD. Veuillez plutôt charger l'environnement StdEnv/2020 et un compilateur plus récent.
]])
else
LmodWarning([[You are attempting to load the intel compiler on a computer equiped with AMD processors.
Software compiled with the Intel compiler in the standard environments StdEnv/2016.4 and StdEnv/2018.3 are not compatible
with AMD processors. Please instead use the StdEnv/2020 standard environment and a more recent compiler.
]])
end
end
end
end
function default_module_change_warning(t)
local moduleName = myModuleName()

-- only go further for StdEnv
if (moduleName ~= "StdEnv" and moduleName ~= "python") then return end
-- allow to completely disable the upcoming transition
local enableStdEnv2020Transition = os.getenv("RSNT_ENABLE_STDENV2020_TRANSITION") or "unknown"
if (enableStdEnv2020Transition == "unknown") then
-- Niagara sets the variable locally
local cccluster = os.getenv("CC_CLUSTER") or "computecanada"
if (cccluster == "cedar" or cccluster == "graham" or cccluster == "beluga") then
enableStdEnv2020Transition = "yes"
else
enableStdEnv2020Transition = "no"
end
end
if (enableStdEnv2020Transition == "no") then return end

local FrameStk = require("FrameStk")
local frameStk = FrameStk:singleton()
local userProvidedName = frameStk:userName()
local moduleFullName = t.modFullName
-- do not go further if the user provided the name with the version
if (userProvidedName == moduleFullName) then return end

local moduleVersion = myModuleVersion()
local defaultKind
if convertToCanonical(LmodVersion()) >= convertToCanonical("8.4.20") then
defaultKind = t.mname:defaultKind()
else
defaultKind = "unknown" -- before 8.4.20, we can not detect if the default comes from the user, so we display the warning regardless
end

local lang = os.getenv("LANG") or "en"

-- only show the warning if the user provided "StdEnv" as load, if the defaultKind is system, and if it does not result in 2020
if (userProvidedName == "StdEnv" and moduleVersion ~= "2020" and (defaultKind == "system" or defaultKind == "unknown")) then
--color_banner("red")
if (string.sub(lang,1,2) == "fr") then
LmodWarning([[Attention, le 1er avril 2021, la version par défaut de l'environnement standard sera mise à jour.
Pour tester vos tâches avec le nouvel environnement, exécutez la commande :
module load StdEnv/2020

Pour changer votre version par défaut immédiatement, exécutez la commande suivante :

echo "module-version StdEnv/2020 default" >> $HOME/.modulerc

Pour davantage d'information, visitez :
https://docs.computecanada.ca/wiki/Standard_software_environments/fr]])
else
LmodWarning([[Warning, April 1st 2021, the default standard environment module will be changed to a more recent one.
To test your jobs with the new environment, please run:
module load StdEnv/2020

To change your default version immediately, please run the following command:

echo "module-version StdEnv/2020 default" >> $HOME/.modulerc

For more information, please see:
https://docs.computecanada.ca/wiki/Standard_software_environments]])
end
--color_banner("red")
end

-- only show the warning if the user provided a shortened version of python as load, if the defaultKind is system or marked, and if it does not result in 3.10.2
if (userProvidedName == "python" or userProvidedName == "python/3" or userProvidedName == "python/3.") then
if (moduleVersion ~= "3.10.2" and (defaultKind == "system" or defaultKind == "unknown" or defaultKind == "marked")) then
if (string.sub(lang,1,2) == "fr") then
LmodWarning([[Attention, le 4 avril 2023, la version par défaut de python deviendra 3.10.
Pour continuer d'utiliser la version 3.8, veuillez charger le module python/3.8 explicitement.
]])
else
LmodWarning([[Warning. On April 4th 2023, the default version of python will become 3.10.
To keep using python 3.8, please load the python/3.8 module explicitly.
]])
end
end
--color_banner("red")
end
end

function incomplete_version_warning(t)
local min_digits = {
[ { "python", "arrow" } ] = 2,
[ { "scipy-stack", "StdEnv" } ] = 1,
}

for modules,min_digit in pairs(min_digits) do
------------------------------------------------------------
-- Look for fullName first otherwise sn
if (has_value(modules,myModuleFullName()) or has_value(modules,myModuleName())) then
----------------------------------------------------------
local FrameStk = require("FrameStk")
local frameStk = FrameStk:singleton()
local userProvidedName = frameStk:userName()
local userProvidedVersion = string.match(userProvidedName, "/(.*)") or ""
local num_digit = 0
if userProvidedVersion == "" then
num_digit = 0
else
local _, num_dot = string.gsub(userProvidedVersion, "%.", "")
num_digit = num_dot+1
end
if (num_digit < min_digit) then
local lang = os.getenv("LANG") or "en"
if (string.sub(lang,1,2) == "fr") then
LmodWarning([[Attention, vous avez chargé le module ]] .. myModuleName() .. [[ en spécifiant une version incomplète: "]] .. userProvidedVersion .. [[".
Nous vous recommandons fortement de spécifier au moins ]] .. min_digit .. [[ chiffres pour la version de ce module. Dans le cas contraire, une future mise à jour
de ce module pourrait faire échouer vos tâches.]])
else
LmodWarning([[Warning, you have loaded the module ]] .. myModuleName() .. [[ by specifying an incomplete version: "]] .. userProvidedVersion .. [[".
We strongly recommend that you specify at least ]] .. min_digit .. [[ digits for the version of this module. Not doing this could crash your jobs when we install a newer version in the future.]])
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a word about reproducibility of jobs/submission scripts as it a strong argument along with job crashes.

Something like?
`... Not doing this could crash or make your jobs non-reproducible when we install a newer version in the future.

end
end
end
end
end