pathos scripts documentation
pathos_connect script
connect to the specified machine and start a ‘server’, ‘tunnel’, or both
Notes
- Usage: pathos_connect [hostname] [server] [remoteport] [profile]
[hostname] - name of the host to connect to [server] - name of RPC server (assumes is installed on host) or ‘tunnel’ [remoteport] - remote port to use for communication or ‘tunnel’ [profile] – name of shell profile to source on remote environment
Examples:
$ pathos_connect computer.college.edu ppserver tunnel
Usage: pathos_connect [hostname] [server] [remoteport] [profile]
[hostname] - name of the host to connect to
[server] - name of RPC server (assumes is installed on host) or 'tunnel'
[remoteport] - remote port to use for communication or 'tunnel'
[profile] -- name of shell profile to source on remote environment
defaults are: "localhost" "tunnel" "" ""
executing {ssh -N -L 22921:computer.college.edu:15058}'
Server running at port=15058 with pid=4110
Connected to localhost at port=22921
Press <Enter> to kill server
- connect(host, port=None, through=None)
establish a secure tunnel connection to a remote host at the given port
- Parameters:
established (host -- hostname to which a tunnel should be)
number (port -- port)
None] (through -- 'tunnel-through' hostname [default =)
- copy(source, destination=None, **kwds)
copy source to (possibly) remote destination
Execute a copy, and return the copier. Use ‘kill’ to kill the copier, and ‘pid’ to get the process id for the copier.
- Parameters:
'file' (source -- path string of source)
target (destination -- path string for destination)
- execute(command, host=None, bg=True, **kwds)
execute a command (possibly) on a remote host
Execute a process, and return the launcher. Use ‘response’ to retrieve the response from the executed command. Use ‘kill’ to kill the launcher, and ‘pid’ to get the process id for the launcher.
- Parameters:
executed (command -- command string to be)
None (host -- hostname of execution target [default =)
True] (bg -- run as background process? [default =)
- get_profile(rhost, assume=True)
get the default $PROFILE for a remote host
- getchild(pid=None, host=None, group=False)
get all child process ids for the given parent process id (ppid)
If pid is None, the pid of the __main__ python instance will be used.
- Parameters:
id (group -- get process ids for the parent group)
running (host -- hostname where process is)
id
- getpid(target=None, host=None, all=False, **kwds)
get the process id for a target process (possibly) running on remote host
This method should only be used as a last-ditch effort to find a process id. This method __may__ work when a child has been spawned and the pid was not registered… but there’s no guarantee.
If target is None, then get the process id of the __main__ python instance.
- Parameters:
process (target -- string name of target)
running (host -- hostname where process is)
False] (all -- get all resulting lines from query? [default =)
- getppid(pid=None, host=None, group=False)
get parent process id (ppid) for the given process
If pid is None, the pid of the __main__ python instance will be used.
- Parameters:
id (group -- get parent group)
running (host -- hostname where process is)
id
- kill(pid, host=None, **kwds)
kill a process (possibly) on a remote host
- Parameters:
id (pid -- process)
None (host -- hostname where process is running [default =)
- randomport(host=None)
select a open port on a (possibly) remote host
- Parameters:
port (host -- hostname on which to select a open)
- register_profiles(profiles)
add dict of {‘host’:$PROFILE} to registered host profiles
- serve(server, host=None, port=None, profile='.bash_profile')
begin serving RPC requests
- Parameters:
server – name of RPC server (i.e. ‘ppserver’)
host – hostname on which a server should be launched
port – port number (on host) that server will accept request at
profile – file to configure the user’s environment [default=’.bash_profile’]
portpicker script
This script prints out an available port number.
- class portnumber(min=0, max=65536)
Bases:
object
port selector
- Usage:
>>> pick = portnumber(min=1024,max=65535) >>> print( pick() )
select a port number from a given range.
The first call will return a random number from the available range, and each subsequent call will return the next number in the range.
- Parameters:
0] (min -- minimum port number [default =)
65536] (max -- maximum port number [default =)
- __call__()
Call self as a function.