diff --git a/src/slurmmanager.jl b/src/slurmmanager.jl index bd9ba2e..639ea0c 100644 --- a/src/slurmmanager.jl +++ b/src/slurmmanager.jl @@ -122,8 +122,60 @@ function _new_environment_additions(params_env::Dict{String, String}) return env2 end +function warn_if_unexpected_params(params::Dict) + params_that_we_support = [:dir, :exename, :exeflags] + upstreams_defaults = Distributed.default_addprocs_params() + for (k, v) in pairs(params) + if k == :env + # We special-case `:env`, because our support status depends on the Julia version + if v == [] + # Either the user didn't provide the `:env` kwarg, + # or the user provided `env=[]`. + # + # Either way, in this case, we don't print a log message. + # @debug "k == :env and v == []" k v + else + # In this case, the user has provided the `:env` kwarg, and it is nonempty. + if Base.VERSION < v"1.6.0" + @warn "The user provided the `env` kwarg, but SlurmClusterManager.jl's support for the `env` kwarg requires Julia 1.6 or later" Base.VERSION + else + # Here, the Julia version is >= 1.6, so we do support `:env`, + # and there is no problem. + end + end + elseif k in params_that_we_support + # We support this param, so no problem. + else + # We don't support this param. + + # So let's see if this is something that Distributed.jl would provide by default. + if haskey(upstreams_defaults, k) + # This is a param that Distributed.jl would provide by default. + # So now the question is: is this the default value provided by Distributed.jl, + # or did the user override the value? + this_is_upstreams_default_value = v == upstreams_defaults[k] + if this_is_upstreams_default_value + # So now the question is: is this the default value provided by Distributed.jl, + # This IS the default value provided by Distributed.jl, so we won't print a log message. + # @debug "" k v this_is_upstreams_default_value + else + # This is NOT the default value provided by Distributed.jl. + # So the user must have overriden the value. + @warn "SlurmClusterManager.jl does not support this kwarg: $(k)" kwarg=k value=v + end + else + # This is not a param that Distributed.jl provides by default. + @warn "SlurmClusterManager.jl does not support this custom kwarg: $(k)" kwarg=k value=v + end + end + end + return nothing +end + function Distributed.launch(manager::SlurmManager, params::Dict, instances_arr::Array, c::Condition) try + warn_if_unexpected_params(params) + exehome = params[:dir] exename = params[:exename] exeflags = params[:exeflags]