schrodinger.job.remote_command module¶
-
exception
schrodinger.job.remote_command.
CommandError
(sp_error=None, command='', errmsg=None, output='', userhost='', returncode=None)¶ Bases:
exceptions.Exception
Used to report external commands that fail.
When this is caught by the main cmdline driver, the error message will be printed and the usage message displayed.
-
schrodinger.job.remote_command.
get_rsh_exec
()¶ Return the name of the rsh-compatible program to use for executing remote commands.
-
schrodinger.job.remote_command.
remote_command
(command, host, user=None, capture_stderr=False, encode=None)¶ Execute a the given command on a particular host.
Returns a tuple containing the captured output and an error message.
Parameters: - host (string) – the host on which to run the command
- user (string) – the user account under which to run the command
- command (string) – the command to be executed on the remote machine
- capture_stderr (boolean) – should stderr be captured along with stdout?
- encode (string) – Decode the remote command output using this encoding.
Return type: Returns: the captured output from the command
Raises: CommandError – if the remote command fails
-
schrodinger.job.remote_command.
rsh_put_cmd
(remotehost, put_fn, remoteuser=None)¶ Returns the ‘scp’ command needed to execute to copy a file to a given remote host. The actual remote command needs to be appended to the returned string.
Parameters: Return type: list
Returns: the list of command args for the command, suitable for use in subprocess functions
-
schrodinger.job.remote_command.
rsh_test
(hosts)¶ Test remote commands to and from one or more hosts.
-
schrodinger.job.remote_command.
shell
()¶ Return the pathname to a Bourne-compatible shell that can be used for running shell commands.
-
schrodinger.job.remote_command.
which
(program, search_path=None)¶ Search for a file in the given list of directories. Use $PATH if no search path is specified.
Returns the absolute pathname for the first executable found.
Parameters: rogram – the executable to search for Return type: string Returns: the absolute pathname for the executable found, or None if the program could not be found.