schrodinger.autoinstall.misc module¶
- class schrodinger.autoinstall.misc.OperatingSystem¶
Bases:
Enum
An enumeration for supported operating systems.
- UBUNTU = 'ubuntu'¶
- ROCKY = 'rocky'¶
- RHEL = 'rhel'¶
- FEDORA = 'fedora'¶
- UNSUPPORTED = 1¶
- classmethod from_string(os_id_str: str)¶
Determines the OperatingSystem enum member from a distribution ID string.
- Parameters:
os_id_str – The distribution ID string (e.g., ‘ubuntu’).
- Returns:
The corresponding
OperatingSystem
enum member.
- schrodinger.autoinstall.misc.generate_pw(length=20) str ¶
Generates a random password of a specified length.
- Parameters:
length – The desired length of the password.
- Returns:
A string containing the generated password.
- schrodinger.autoinstall.misc.extract_port(file_path: str) int | None ¶
Extracts the port number from a systemd service file.
It searches for the
-port
argument in theExecStart
line.- Parameters:
file_path – The path to the systemd service file.
- Returns:
The port number as an integer, or
None
if not found.
- schrodinger.autoinstall.misc.check_slm_status(schrod_ipath: str) bool ¶
Runs
lictest -v MMLIBS
to check ifMMLIBS
tokens can be checked out.- Parameters:
schrod_ipath – The path to the Schrodinger installation.
- Returns:
True
ifMMLIBS
tokens can be checked out,False
otherwise.
- schrodinger.autoinstall.misc.check_for_queue_execs() str | None ¶
Checks if a known queuing system executable is in the user’s PATH.
- Returns:
The name of the detected queueing system (e.g., ‘slurm’), or
None
if none is found.
- schrodinger.autoinstall.misc.format_json_output(dictdata: dict) list ¶
Takes a dictionary, converts it to a formatted JSON string, and cleans it.
Removes brackets, braces, quotation marks, and trailing commas.
- Parameters:
dictdata – The dictionary to format.
- Returns:
A list of formatted strings.
- schrodinger.autoinstall.misc.get_max_cuda_cores(ipath: str) int ¶
Queries for the maximum number of (discounted) CUDA cores available.
- Parameters:
ipath – The path to the Schrodinger installation.
- Returns:
The maximum number of discounted cores as an integer.
- schrodinger.autoinstall.misc.get_host_entries(ipath: str, ncpu: int, ngpu: int, logger: Logger = None) str ¶
Generates content for the schrodinger.hosts file using a Jinja2 template.
- Parameters:
ipath – The path to the Schrodinger installation.
ncpu – The number of CPU cores.
ngpu – The number of GPUs.
logger – An optional logger instance.
- Returns:
The rendered content for the
schrodinger.hosts
file.
- schrodinger.autoinstall.misc.ident_release_by_installsource(installsource: str) str ¶
Identifies the Schrödinger release version from the installer name or URL.
- Parameters:
installsource – The installer name or download link.
- Returns:
The identified release version string.
- schrodinger.autoinstall.misc.ident_release_by_installpath(schrod_path: str) str ¶
Identifies the Schrödinger release version from the version.txt file.
- Parameters:
schrod_path – The path to the Schrodinger installation.
- Returns:
The identified release version string.
- schrodinger.autoinstall.misc.download_from_url(url: str, fpath: str, logger: Logger)¶
Downloads a file from a URL to a specified local path.
- Parameters:
url – The URL to download from.
fpath – The local file path to save the downloaded content.
logger – A logger instance for logging messages.
- schrodinger.autoinstall.misc.run_shellcmd(command: list, logger: Logger, shellset: bool = False)¶
Runs a shell command and logs its output in real-time.
If ORIGINAL_LD_LIBRARY_PATH is set, automatically resets LD_LIBRARY_PATH to original value before executing. For running ‘dnf’ package manager commands PYTHONHOME needs to be unset.
- Parameters:
command – The command to run as a list of arguments.
logger – A logger instance for logging command execution and output.
shellset – If
True
, the command is executed through the shell.
- Returns:
None
on success, or theCalledProcessError
exception on failure.
- schrodinger.autoinstall.misc.get_logger(stagename: str = None) Logger ¶
Returns a configured logger instance.
INFO and higher messages are logged to the console.
DEBUG and higher messages are logged to ‘autoinstall.log’.
If a
stagename
is provided, console logs will be colorized and include the stage name.- Parameters:
stagename – Optional stage name to include in the logs.
- Returns:
A configured logger instance.