bartender.schedulers.runner#
Classes#
Protocol for running a command. |
|
Runs command on system where current Python process is running. |
|
Run command on a remote machine using SSH. |
Module Contents#
- class bartender.schedulers.runner.CommandRunner#
Bases:
ProtocolProtocol for running a command.
- async run(command: str, args: list[str], stdin: str | None = None, cwd: pathlib.Path | None = None) tuple[int, str, str]#
Run command.
- Parameters:
command (str) – Command to execute. Command can not contain spaces.
args (list[str]) – List of arguments for command. Argument containing spaces should be wrapped in quotes.
stdin (Optional[str]) – Input for command.
cwd (Optional[pathlib.Path]) – In which directory the command should be run.
- Returns:
Tuple with return code, stdout and stderr.
- Return type:
- class bartender.schedulers.runner.LocalCommandRunner#
Bases:
CommandRunnerRuns command on system where current Python process is running.
- async run(command: str, args: list[str], stdin: str | None = None, cwd: pathlib.Path | None = None) tuple[int, str, str]#
Run command.
- Parameters:
command (str) – Command to execute. Command can not contain spaces.
args (list[str]) – List of arguments for command. Argument containing spaces should be wrapped in quotes.
stdin (Optional[str]) – Input for command.
cwd (Optional[pathlib.Path]) – In which directory the command should be run.
- Raises:
ValueError – Command is both running and dead.
- Returns:
Tuple with return code, stdout and stderr.
- Return type:
- class bartender.schedulers.runner.SshCommandRunner(config: bartender.shared.ssh.SshConnectConfig)#
Bases:
CommandRunnerRun command on a remote machine using SSH.
- Parameters:
config (bartender.shared.ssh.SshConnectConfig) –
- config#
- conn: asyncssh.SSHClientConnection | None = None#
- async run(command: str, args: list[str], stdin: str | None = None, cwd: pathlib.Path | None = None) tuple[int, str, str]#
Run command.
- Parameters:
command (str) – Command to execute. Command can not contain spaces.
args (list[str]) – List of arguments for command. Argument containing spaces should be wrapped in quotes.
stdin (Optional[str]) – Input for command.
cwd (Optional[pathlib.Path]) – In which directory the command should be run.
- Raises:
ValueError – Command is both running and dead.
- Returns:
Tuple with return code, stdout and stderr.
- Return type:
- __enter__() SshCommandRunner#
- Return type: