schrodinger.job.remote_command module¶
-
exception
schrodinger.job.remote_command.CommandError(sp_error=None, command='', errmsg=None, output='', userhost='', returncode=None)¶ Bases:
ExceptionUsed 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.
-
__init__(sp_error=None, command='', errmsg=None, output='', userhost='', returncode=None)¶ The constructor takes a subprocess.CalledProcessError for the failed command, from which details of the command are extracted. A user- friendly error message will be composed from that information unless an explicit error message is provided.
-
__str__()¶ Return str(self).
-
__cause__¶ exception cause
-
__class__¶ alias of
builtins.type
-
__context__¶ exception context
-
__delattr__¶ Implement delattr(self, name).
-
__dict__= mappingproxy({'__module__': 'schrodinger.job.remote_command', '__doc__': '\n Used to report external commands that fail.\n\n When this is caught by the main cmdline driver, the error message\n will be printed and the usage message displayed.\n ', '__init__': <function CommandError.__init__>, '__str__': <function CommandError.__str__>, '__weakref__': <attribute '__weakref__' of 'CommandError' objects>})¶
-
__dir__() → list¶ default dir() implementation
-
__eq__¶ Return self==value.
-
__format__()¶ default object formatter
-
__ge__¶ Return self>=value.
-
__getattribute__¶ Return getattr(self, name).
-
__gt__¶ Return self>value.
-
__hash__¶ Return hash(self).
-
__init_subclass__()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__¶ Return self<=value.
-
__lt__¶ Return self<value.
-
__module__= 'schrodinger.job.remote_command'¶
-
__ne__¶ Return self!=value.
-
__new__()¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__()¶ helper for pickle
-
__reduce_ex__()¶ helper for pickle
-
__repr__¶ Return repr(self).
-
__setattr__¶ Implement setattr(self, name, value).
-
__setstate__()¶
-
__sizeof__() → int¶ size of object in memory, in bytes
-
__subclasshook__()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__suppress_context__¶
-
__traceback__¶
-
__weakref__¶ list of weak references to the object (if defined)
-
args¶
-
with_traceback()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
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.
-
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.shell()¶ Return the pathname to a Bourne-compatible shell that can be used for running shell commands.
-
schrodinger.job.remote_command.remote_command(command, host, user=None, capture_stderr=False)¶ 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?
Return type: string
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: - remotehost (string) – string
- put_fn (string) – Path to the file that will be copied over. If it is a directory, it will be copied recursively
- remoteuser (string) – Remote username
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.