Classic Mode

RPyC's classic mode was the (only) mode of operation in older versions of RPyC (1.00 through 2.60). If you have use previous versions of RPyC, you'll be familiar with the classic mode: the server exposes all its modules and packages through the .modules attribute, as well as the eval and exec functions. Beginning with RPyC 3.0, the classic mode is implemented by the slave service. Please refer to the security notes concerning the classic mode.

The classic mode is the easiest to use and deploy, and is used extensively for testing environments, remote control, integration of different hardware and software platforms, and distribution of workload. See the classic mode demo for a comprehensive example.

APIs

The SlaveService exposes the following API:

  • modules - The module namespace of the server, which reflects all the modules and packages installed on the server. In order to gain access to top-level modules, you may use the dot notation, e.g., c.modules.os. In order to access deeper-level modules (such as xml.dom.minidom), you'll have to use the bracket notation, e.g., c.modules["xml.dom.minidom"].
  • eval(expr: str) - The builtin eval function of the server.
  • execute(code: str) - The exec statement which can be used to execute code on the server.
  • namespace - The namespace dict in which eval and execute operate.

Differences from RPyC 2.60

The new classic mode is backwards compatible with the previous versions of RPyC, except for minor syntactic changes. If you wish to port existing python code using RPyC 2.60 to 3.00, the following table below describes the changes you'll have to make:


Instead of Use
import Rpyc
c = Rpyc.SocketConnection("hostname")
import rpyc # lower case
c = rpyc.classic.connect("hostname")
c.modules.xml.dom.minidom.parseString
c.modules["xml.dom.minidom"].parseString
Async(c.modules.foo.bar)
rpyc.async(c.modules.foo.bar) # lower case
Page tags: classic docs
page_revision: 8, last_edited: 1225619958|%e %b %Y, %H:%M %Z (%O ago)
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License