ichor.hpc.useful_functions package

Submodules

ichor.hpc.useful_functions.get_machine module

init_machine(platform_name: str, ichor_config: dict) str

Loops through the keys of the config file, which contain the machine abbreviation/name which is also found in the platform name

Parameters:
  • platform_name – The platform name given by platform.node()

  • ichor_config – A dictionary of the ichor config file, containing names of machines as keys

Returns:

Returns key in config file which is contained in the platform name. If the key is not found, then returns “_default” which would mean that default settings are used

ichor.hpc.useful_functions.get_python_environment module

class PythonEnvironmentPath(venv_env_path: str | None, conda_env_path: str | None)

Bases: object

Class for storing Python environment paths

Parameters:
  • venv_env_path – path of a venv / virtualenv environment

  • conda_env_path – path of a conda environment

property conda_path: Path | None

Returns conda environment path or None if not using a conda environment

property uses_conda: bool

If conda env is used returns True. Otherwise returns false

property uses_venv: bool

If virtualenv /venv are used returns True. Otherwise returns false

property venv_path: Path | None

Returns venv environment path or None if not using a conda environment

get_current_python_environment_path() PythonEnvironmentPath

Gets the current active python environment (venv/virtualenv or conda)

Raises:

PythonEnvironmentNotFound – If no Python environment is detected.

Returns:

PythonEnvironmentPath instance containing Python env info

ichor.hpc.useful_functions.submit_free_flow_python_on_compute module

compile_strings_to_python_code(strings_list: List[str]) str

Takes in a list of strings and concats them with a ; character Then these strings can be executed with python -c

Parameters:

strings_list (List[str]) – _description_

Returns:

_description_

Return type:

str

submit_free_flow_python_command_on_compute(text_list, script_name, ncores)

Module contents

get_current_python_environment_path() PythonEnvironmentPath

Gets the current active python environment (venv/virtualenv or conda)

Raises:

PythonEnvironmentNotFound – If no Python environment is detected.

Returns:

PythonEnvironmentPath instance containing Python env info

init_machine(platform_name: str, ichor_config: dict) str

Loops through the keys of the config file, which contain the machine abbreviation/name which is also found in the platform name

Parameters:
  • platform_name – The platform name given by platform.node()

  • ichor_config – A dictionary of the ichor config file, containing names of machines as keys

Returns:

Returns key in config file which is contained in the platform name. If the key is not found, then returns “_default” which would mean that default settings are used