[py-svn] r6966 - py/dist/doc

hpk at codespeak.net hpk at codespeak.net
Sun Oct 17 05:33:55 CEST 2004


Author: hpk
Date: Sun Oct 17 05:33:54 2004
New Revision: 6966

Modified:
   py/dist/doc/execnet.txt
   py/dist/doc/style.css
Log:
- took out the named signals interface which was 
  not thought out, anyway from execnet, reordered examples 

- slightly improved css



Modified: py/dist/doc/execnet.txt
==============================================================================
--- py/dist/doc/execnet.txt	(original)
+++ py/dist/doc/execnet.txt	Sun Oct 17 05:33:54 2004
@@ -30,8 +30,6 @@
   communication protocols from the client side, making 
   "server" upgrades superflous. 
 
-See file:py/gateway/gateway_test.py for how it works currently. 
-
 High Level Interface for remote execution 
 -----------------------------------------
 
@@ -56,8 +54,8 @@
 
 ...
 
-(Proposed "Channel" VHL interface for exchanging data) 
-------------------------------------------------------
+The "Channel" interface for exchanging data 
+-------------------------------------------
 
 While executing custom strings on "the other side" is simple enough
 it is often tricky to deal with.  Therefore we want a way
@@ -65,8 +63,7 @@
 program.  The idea is to inject a Channel object for each
 execution of source code. This Channel object allows two 
 program parts to send data to each other. 
-
-Here is the rough idea for the interface::
+Here is the current interface:: 
 
     #
     # attributes API 
@@ -76,7 +73,8 @@
 
     channel.timeout  # the default timeout is None, i.e. all operations block
                      # setting the timeout to a number value indicates the 
-                     # timeout in seconds for all operations. 
+                     # timeout in seconds for all operations.
+                     # (not implemented)
     #
     # API for sending and receiving anonymous values
     #
@@ -101,28 +99,32 @@
         reraised as gateway.RemoteError exceptions containing 
         a textual representation of the remote traceback. 
 
-    #
-    # API for setting and getting named values ("named signals")
-    #
-    channel.set(**namevaluepairs):
-        set the given namevaluepairs on the channel object.  
-        These binding will only appear on the remote side of the channel. 
-
-    channel.get(name):
-        return the value from a name binding, possibly blocking 
-        until it appears.  Note that the name is immediately 
-        deleted from the channels namespace. 
-        Obviously, set/get can be used for sending named signals 
-        to each other. 
-
-    # use with caution: 
-    channel.peek(name=None):
-        return a tuple (isvalue, value) where isvalue indicates
-        if the named value was available.  Callers may only assume 
-        a meaningful value if isvalue is True.  Otherwise the value 
-        is undefined.   Please note that the peek function is  
-        a so called "polling" interface and thus can cause scheduling 
-        penalties that may considerably slow down your process. 
+A simple and useful Example for Channels 
+----------------------------------------
+
+problem: retrieving contents of remote files::
+
+    import py
+    contentserverbootstrap = py.code.Source( 
+            """
+            for fn in channel.receive(): 
+                f = open(f, 'rb')
+                try:
+                    channel.send(f.read())
+                finally:
+                    f.close()
+            """ 
+    # open a gateway to a fresh child process 
+    contentgateway = py.execnet.SSHGateway('codespeak.net', identity)
+    channel = contentgateway.remote_exec_async(contentserverbootstrap)
+
+    for fn in somefilelist: 
+        channel.send(fn) 
+        content = channel.receive()
+        # process content 
+     
+    # later you can exit / close down the gateway
+    contentgateway.exit()
 
 An Example for Channels 
 -----------------------
@@ -139,19 +141,19 @@
             py.script.getpath('py.execnet.socketserver').read(), 
             """
             import socket 
-            portrange = channel.get("portrange")
+            portrange = channel.receive()
             for i in portrange: 
                 try:
                     sock = bind_and_listen(("localhost", i))
                 except socket.error: 
                     continue
                 else:
-                    channel.set(listenport=i) 
+                    channel.send(i) 
                     startserver(sock)
                     print "started server with socket"
                     break
             else:
-                channel.set(listenport=None)
+                channel.send(None) 
     """)
            
     # open a gateway to a fresh child process 
@@ -161,12 +163,12 @@
     channel = proxygw.remote_exec_async(socketserverbootstrap) 
 
     # send parameters for the for-loop
-    channel.set(portrange=(7770, 7800))
+    channel.send((7770, 7800))
     #
     # the other side should start the for loop now, we
     # wait for the result
     #
-    listenport = channel.get('listenport') 
+    listenport = channel.receive() 
     if listenport is None: 
         raise IOError, "could not setup remote SocketServer"
    
@@ -178,33 +180,7 @@
     socketgw.exit()
     proxygw.exit()
 
-the example is slightly futuristic but apart from the 
-channel interface the code for the above functionality 
-is there albeit in slightly different namespaces. 
+The example runs as is without the use of "named signals" 
+above.  Only sending and receiving of anonymous values 
+is currently supported. 
 
-Another Example for Channels 
-----------------------------
-
-problem: retrieving contents of remote files::
-
-    import py
-    contentserverbootstrap = py.code.Source( 
-            """
-            for fn in channel.receive(): 
-                f = open(f, 'rb')
-                try:
-                    channel.send(f.read())
-                finally:
-                    f.close()
-            """ 
-    # open a gateway to a fresh child process 
-    contentgateway = py.execnet.SSHGateway('codespeak.net', identity)
-    channel = contentgateway.remote_exec_async(contentserverbootstrap)
-
-    for fn in filelist: 
-        channel.send(fn) 
-        content = channel.receive()
-        # process content 
-     
-    # later you can exit / close down the gateway
-    contentgateway.exit()

Modified: py/dist/doc/style.css
==============================================================================
--- py/dist/doc/style.css	(original)
+++ py/dist/doc/style.css	Sun Oct 17 05:33:54 2004
@@ -1,9 +1,9 @@
 body {
-    background: url(http://codespeak.net/img/codespeak1b.png) no-repeat fixed;
+    background: url(http://codespeak.net/img/codespeak1b.png) no-repeat;
     font: 120% Arial, Verdana, Helvetica, sans-serif;
     border: 0;
-    margin: 0.5em 0em 0.5em 1.5em;
-    padding: 0 0 0 127px; 
+    margin: 0.5em 0em 0.5em 0.5em;
+    padding: 0 0 0 145px; 
 }
 
 a {
@@ -40,13 +40,11 @@
     line-height: 1.5em;
     /*list-style-image: url("bullet.gif"); */
     margin-left: 1em;
-    padding:0;
 }
 
 ol {
     line-height: 1.5em;
     margin-left: 0em;
-    padding:0;
 }
 
 ul a, ol a {



More information about the pytest-commit mailing list