utils.bash

Functions

execute_bash(command[, kill_after_wait, ...])

Bash Wrapper.

execute_bash_parallel(command[, stdout_file])

Executes a number of bash scripts in parallel.

utils.bash.execute_bash(command: str, kill_after_wait: bool = False, stderr_file: Optional[str] = None, stdout_file: Optional[str] = None) str[source]

Bash Wrapper. Gives option to timeout and to write files out of stdout and/or stderr

Args:

command (str or List[str]): command to be executed. kill_after_wait (bool, optional): if true, command is aborted after 10s. Defaults to False. stderr_file (str, optional): file for stderr. Defaults to None. stdout_file (str, optional): file for stdout. Defaults to None.

Raises:

et: if a timeout of the command occurs that is not raised by the bash console. ee: if any other exception occurs that is thrown by the bash console OSError: error if returncode from the bash console is non-zero.

Returns:

str: stdout of the bash console

utils.bash.execute_bash_parallel(command: List[List[str]], stdout_file: Optional[List[str]] = None) List[str][source]

Executes a number of bash scripts in parallel. returs output of all of them. if a list of outputfiles is given, the output is written to these files.

Args:

command (List[List[str]] or List[str]): list of commands to execute. stdout_file (List[str], optional): List of files where the stdout should be store. Defaults to None.

Raises:

e: any exception occuring during the bashcommand. StopIteration: if length of stderr is not eqaul to the number of commands

Returns:

List[str]: List of the stdoutputs given by each process.