Skip to content

Assigning priority weight on values to set to variables #186

Description

@xdelaruelle

Coming from the need to make a value persist on a variable that could be set from multiple modulefiles.

Priority weight is a solution often used when a given "stuff" can be obtained from multiple providers. Priority weight helps to select the primary provider. This solution is used for instance when dealing with package repositories to configure the repository that has the precedence over everything else when installing a system.

Applied to an environment variable domain, priority weight could help to determine what variable value to retain among multiple possibilities.

When using setenv command, a --priority argument could be added to assign a priority weight to the value set.

  • Values with no specific priority weight set owns a default priority weight (default weight value to be defined)
  • For two values with same priority weight, lastly set will take the high ground
  • Top priority value is kept if new assignment has a lesser priority.
  • When top priority value is unset, variable is set to the newly top priority value if any (which means lesser-priority values are stacked in the environment to get able to get set to the variable if top priority is unloaded)
setenv --priority 100 VAR val1
setenv VAR val2

In this example, resulting VAR equals val1.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions