glusto.rpycable module

All things rpyc connection.

Note

Rpycable is inherited by the Glusto class and not designed to be instantiated.

Warning

Rpyc breaks in mixed Python 2.x/3.x environments. When using rpyc, you will only be able to successfully make rpyc calls against a system running the same version of Python. (see rpyc module install docs for more information)

class glusto.rpycable.Rpycable

Bases: object

classmethod rpyc_get_connection(host, user=None, instance=1)

Setup and cache a connection via rpyc.

Parameters:
  • host (str) – The hostname or IP of the remote system.
  • user (str) – A user on the remote system. Default: root
  • instance (int) – The number of the instance when multiple connections are used.
Returns:

A new or cached rpyc connection object.

classmethod rpyc_create_connections(hosts, user=None, num_instances=1)

Setup and cache multiple connections via rpyc.

Parameters:
  • host (str) – The hostname or IP of the remote system.
  • user (str) – A user on the remote system. Default: root
  • num_instances (int) – The number of the instances to create.
Returns:

Nothing.

classmethod rpyc_get_connections()

Get the connection dictionary.

Parameters:None
Returns:The dictionary of rpyc connections.
classmethod rpyc_list_connections()

Display the list of existing ssh connections on stdout.

Parameters:None
Returns:Nothing
classmethod rpyc_list_deployed_servers()
classmethod rpyc_check_connection(host, user=None, instance=1)

Check whether a connection is open or closed.

Parameters:
  • host (str) – The hostname or IP of the remote system.
  • user (str) – A user on the remote system. Default: root
  • instance (int) – The number of the instance when multiple connections are used.
Returns:

Nothing

classmethod rpyc_ping_connection(host, user=None, instance=1)

Ping an rpyc connection.

Parameters:
  • host (str) – The hostname or IP of the remote system.
  • user (str) – A user on the remote system. Default: root
  • instance (int) – The number of the instance when multiple connections are used.
Returns:

True if pingable. False if does not ping.

classmethod rpyc_close_connection(host=None, user=None, instance=1)

Close an rpyc connection.

Parameters:
  • host (str) – The hostname or IP of the remote system.
  • user (str) – A user on the remote system. Default: root
  • instance (int) – The number of the instance when multiple connections are used.
Returns:

Nothing.

classmethod rpyc_close_connections()

Close all rpyc connections.

Parameters:None
Returns:Nothing
classmethod rpyc_close_deployed_servers()

Close all deployed server connections.

Parameters:None
Returns:Nothing
classmethod rpyc_close_deployed_server(host=None, user=None)

Close a deployed server connection.

Parameters:
  • host (str) – The hostname or IP of the remote system.
  • user (str) – A user on the remote system. Default: root
Returns:

Nothing.

classmethod rpyc_define_module(connection, local_module)

Define a local module on the remote system

Parameters:
  • connection (obj) – An rpyc connection object.
  • local_module (obj) – The module object being defined on the remote.
Returns:

A module object representing the local module defined on remote