cotainr.util module#
cotainr - a user space Apptainer/Singularity container builder.
Copyright DeiC, deic.dk Licensed under the European Union Public License (EUPL) 1.2 - see the LICENSE file for details.
This module implements utility functions.
Functions#
- stream_subprocess(*, args, **kwargs)
Run a the command described by args while streaming stdout and stderr.
- get_systems()
Get a dictionary of predefined systems, defined in systems.json
Attributes#
- systems_file
The path to the systems.json file (if present).
API reference#
- cotainr.util.get_systems()#
Get a dictionary of predefined systems, defined in the systems.json file.
- Returns:
- systemsDict
A dictionary of predefined systems
- Raises:
NameErrorIf some required arguments are missing in the systems.json file.
- cotainr.util.stream_subprocess(*, args, **kwargs)#
Run a the command described by args while streaming stdout and stderr.
The command described by args is run in a subprocess with that subprocess’ stdout and stderr streamed to the stdout. Extra kwargs are passed to Popen when opening the subprocess.
- Parameters:
- argslist or str
Program arguments. See the docstring for
subprocess.Popenfor details.
- Returns:
- completed_process
subprocess.CompletedProcess Information about the completed subprocess.
- completed_process
- Raises:
subprocess.CalledProcessErrorIf the subprocess returned a non-zero status code.