cohydra.command_executor.base¶
Base abstract class for a node.
Classes
The CommandExecutor abstracts away the code for running |
Exceptions
An ExitCode is a container for storing a commands exit code. |
-
class
cohydra.command_executor.base.
CommandExecutor
(name='unnamed')[source]¶ Bases:
object
- The CommandExecutor abstracts away the code for running
code on a Node.
- Parameters
name (str) – You can specify a name for logging purposes.
-
name
= None¶ The name of the CommandExecutor.
-
counter
= None¶ A counter for loggers.
-
execute
(command, user=None, shell=None, stdout_logfile=None, stderr_logfile=None)[source]¶ Execute a command.
- Parameters
command (str) – The command to run.
user (str) – The user to run the command as.
shell (str) – The type of shell to use (
sh
,bash
, …).stdout_logfile (str) – The path to the log file to append the stdout output.
stderr_logfile (str) – The path to the log file to append the stderr output.
-
exception
cohydra.command_executor.base.
ExitCode
(code: int, command: str)[source]¶ Bases:
Exception
An ExitCode is a container for storing a commands exit code.
- Parameters
code – The exit code.
command – The command that was executed.
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Inheritance Diagramm