Package schrodinger :: Package job :: Module remote_command
[hide private]
[frames] | no frames]

Module remote_command

Classes [hide private]
  CommandError
Used to report external commands that fail.
Functions [hide private]
string
which(program, search_path=None)
Search for a file in the given list of directories.
 
get_rsh_exec()
Return the name of the rsh-compatible program to use for executing remote commands.
 
shell()
Return the pathname to a Bourne-compatible shell that can be used for running shell commands.
 
_filter_rsh_output(content)
Filter the rsh output like 'Connection to <host> closed.' from getting printed to the stream.
string
remote_command(command, host, user=None, capture_stderr=False, encode=None)
Execute a the given command on a particular host.
string
_get_remote_user(remoteuser=None)
Return the remote user to use with rsh command
list
_rsh_cmd(remotehost, remoteuser=None, nostdin=True)
Returns the 'ssh' command needed to execute a remote command on the given host.
 
rsh_test(hosts)
Test remote commands to and from one or more hosts.
Variables [hide private]
  logger = log.getLogger('rcmd')
  handler = log.StreamHandler(sys.stderr)
  rsh_timeout = 60
  rsh_max_retries = 1
  debug = 0
hash(x)
  test_reverse_rsh = False
hash(x)
  hostname = 'pdx-buildbot-lv25.vmss.schrodinger.com'
  schrodinger_dir = u'/scr/buildbot/savedbuilds/NB/2016-4/build-...
  shell_exec = None
hash(x)
  rsh_exec = None
hash(x)
  rsh_src = None
hash(x)
  rsh_errors_re = 'Server refused our key|Permission denied|Conn...
  rsh_warning_issued = 0
hash(x)
  __package__ = 'schrodinger.job'
Function Details [hide private]

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
  • program (string)
Returns: string
the absolute pathname for the executable found, or None if the program could not be found.

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.
Returns: string
the captured output from the command
Raises:

_get_remote_user(remoteuser=None)

 

Return the remote user to use with rsh command

Parameters:
  • remoteuser (string) - string
Returns: string
return the remote user for rsh command

_rsh_cmd(remotehost, remoteuser=None, nostdin=True)

 

Returns the 'ssh' command needed to execute a remote command on the given host. The actual remote command needs to be appended to the returned string.

Parameters:
  • host (string) - string
  • user (string) - string
  • nostdin (boolean) - should stdin be closed for this command?
Returns: list
the list of command args for the remote command, suitable for use in subprocess functions

Variables Details [hide private]

schrodinger_dir

Value:
u'/scr/buildbot/savedbuilds/NB/2016-4/build-126'

rsh_errors_re

Value:
'Server refused our key|Permission denied|Connection abandoned|No rout\
e to host|Host does not exist|Name or service not known'