System Tools#
Source code in wellies/tools.py
__init__(name, depends=[], load='', unload='', setup='', options={})
#
A tool is a software that can be loaded/unloaded in the task script. The tool can be a module, a package, a virtual environment, etc. A tool provides three scripts: - load: script to load the tool - unload: script to unload the tool - setup: script to install the tool (in the deploy family)
Parameters#
name: str name of the tool depends: list of str list of tools that must be loaded before this tool load: str or list of str bash script to load the tool unload: str or list of str bash script to unload the tool setup: str or list of str bash script to setup the tool options: dict dictionary of options for the tool
Source code in wellies/tools.py
Bases: Tool
Source code in wellies/tools.py
__init__(name, module_name, version, depends=[], options={})
#
A module tool is a tool that can be loaded/unloaded using the module system.
Parameters#
name: str name of the tool module_name: str name of the module version: str version of the module depends: list of str list of tools that must be loaded before this tool options: dict dictionary of options for the tool
Source code in wellies/tools.py
Bases: Tool
Source code in wellies/tools.py
__init__(name, module_name, version, modulefiles, depends=[], options={})
#
Extension of the ModuleTool class to load a module from a custom modulefile path.
Parameters#
name: str name of the tool module_name: str name of the module version: str version of the module modulefiles: str path to the custom modulefile depends: list of str list of tools that must be loaded before this tool options: dict dictionary of options for the tool
Source code in wellies/tools.py
Bases: Tool
Source code in wellies/tools.py
__init__(name, var, value, setup=None, depends=[], options={})
#
Environment variable tool. When loading, it set the environment variable to the given value. If the value contains the string PATH (for instance PATH or PYTHONPATH), then the value is added to the environment variable. For instance: export PATH=/this/his/the/path:$PATH
Parameters#
name: str name of the tool var: str name of the envirpnment variable value: str path to set to the environment variable setup: str or list of str setup script used to deploy the tool depends: list of str list of tools that must be loaded before this tool options: dict dictionary of options for the tool
Source code in wellies/tools.py
Installables#
Bases: Tool
Source code in wellies/tools.py
__init__(name, lib_dir, options)
#
Package tool that installs a user package in an environment. The package is downloaded in the lib_dir/build directory and the user must provide a script to install the package in the environment.
Parameters#
name: str name of the tool. lib_dir: str path to the lib directory. options: dict dictionary of options for the tool.
Source code in wellies/tools.py
Environments#
Bases: EnvVarTool
Source code in wellies/tools.py
__init__(name, lib_dir, depends=[], options={})
#
Folder tool extending the environment variable tool. It updates the PATH environment variable to include the folder located in lib_dir/name.
Parameters#
name: str name of the tool. lib_dir: str path to the lib directory of the suite. depends: list of str list of tools that must be loaded before this tool. options: dict dictionary of options for the tool.
Source code in wellies/tools.py
Bases: Tool
Source code in wellies/tools.py
__init__(name, lib_dir, venv_options='', extra_packages=[], depends=[], options={})
#
A tool that creates a python virtual environment and sets the right scripts to load it, unload it and install it.
Parameters#
name : str
The name of the tool.
lib_dir : str
The path to the lib directory.
venv_options : Union[str, List[str]], optional
Additional options to pass to the python3 -m venv command, by
default "".
depends : List[str], optional
A list of dependencies for the tool, by default [].
options : Dict[str], optional
A dictionary of options for the tool, by default {}.
Source code in wellies/tools.py
Bases: VirtualEnvTool
Source code in wellies/tools.py
__init__(name, lib_dir, venv_options='', extra_packages=[], depends=[], options={})
#
An extension of the VirtualEnvTool class that creates a python virtual environment that extends the current environment, i.e. with the --system-site-packages option.
Parameters#
name : str
The name of the tool.
lib_dir : str
The path to the lib directory.
venv_options : Union[str, List[str]], optional
Additional options to pass to the python3 -m venv command, by
default "".
depends : List[str], optional
A list of dependencies for the tool, by default [].
options : Dict[str], optional
A dictionary of options for the tool, by default {}.
Source code in wellies/tools.py
Bases: Tool
Source code in wellies/tools.py
__init__(name, environment, setup=None, depends=[], conda_activate_cmd='conda', options={})
#
An environment tool that can load and unload a conda environment.
Parameters#
name : str The name of the tool. environment : str The name or path of the conda environment. setup : str, optional The setup script, by default None. depends : List[str], optional A list of dependencies for the tool, by default []. conda_activate_cmd : str, optional The conda command to use to load the environment, some login-nodes require "source" instead of "conda" by default "conda". options : Dict[str, str], optional A dictionary of options for the tool, by default {}.
Source code in wellies/tools.py
Bases: CondaEnvTool
Source code in wellies/tools.py
__init__(name, lib_dir, env_file, depends=[], conda_cmd='conda', conda_activate_cmd='conda', options={})
#
An extension of the CondaEnvTool class that also creates a conda environment in the lib directory. The conda environment is created from a conda environment file. The path to the environment file is specified as a dictionary following the StaticData options format, for instance:
my_env:
env_file:
type: copy
source: /path/to/environment.yml
my_env2:
env_file:
type: git
source: git@github.com:myrepo.git
branch: master
files: myenvironment.yml
Parameters#
name : str The name of the tool. lib_dir : str The path to the lib directory of the suite. env_file : str The options to retrieve the environment file. depends : List[str], optional A list of dependencies for the tool, by default []. conda_cmd : str, optional The conda command to use, by default "conda". options : Dict[str, str], optional A dictionary of options for the tool, by default {}.
Source code in wellies/tools.py
Bases: CondaEnvTool
Source code in wellies/tools.py
__init__(name, lib_dir, packages, depends=[], conda_cmd='conda', conda_activate_cmd='conda', options={})
#
An extension of the CondaEnvTool class that also creates a conda environment in the lib directory. The conda environment is created from a list of conda packages.
Parameters#
name : str The name of the tool. lib_dir : str The path to the lib directory of the suite. packages : str or list of str The options to retrieve the environment file. depends : List[str], optional A list of dependencies for the tool, by default []. conda_cmd : str, optional The conda command to use, by default "conda". options : Dict[str, str], optional A dictionary of options for the tool, by default {}.
Source code in wellies/tools.py
Tool Store#
Source code in wellies/tools.py
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | |
__init__(lib_dir, options)
#
The ToolStore class is a container for all the tools of a suite. The constructor parses the options and creates the tools.
Parameters#
lib_dir : str The path to the lib directory of the suite. options : Dict[str, str], optional A dictionary of options containing all the tools and their options.
Source code in wellies/tools.py
add_tool(toolname, tool)
#
Adds a tool to the tool store.
Parameters#
toolname : str The name of the tool. tool : Tool The tool object to add to the dictionary of tools.
Source code in wellies/tools.py
depends(toolname)
#
Returns the dependencies of a tool.
Parameters#
toolname : str The name of the tool.
Returns#
list : the list of dependcies of the tool
Source code in wellies/tools.py
load(tools)
#
Returns the load script of one or multiple tools.
Parameters#
tools : str or list of str The tools to load.
Returns#
list : a list of scripts to load the tools
Source code in wellies/tools.py
setup(toolname)
#
Returns the setup script of the tool.
Parameters#
toolname : str The tool to setup.
Returns#
list : a list of scripts to setup the tool
Source code in wellies/tools.py
tool_script(script_type, toolname)
#
Returns the script of a tool and its dependencies.
Parameters#
script_type : str The type of script (load, unload or setup). toolname : str The name of the tool.
Returns#
dict: a dictionary of tools -> scripts
Source code in wellies/tools.py
unload(tools)
#
Returns the unload script of one or multiple tools. In this case we reverse the dependency order to unload the tools.
Parameters#
tools : str or list of str The tools to unload.
Returns#
list : a list of scripts to unload the tools