pypy / demo / distribution / client.py

""" This a sample client, suitable for use with server.py from this
directory

run by:
pypy-c client.py
"""

HOST = '127.0.0.1'
PORT = 12222

from distributed.socklayer import connect
remote_handle = connect((HOST, PORT))

import code
code.interact(local=locals())

""" Things that can be done: 1. remote object access

x = remote_handle.x
assert type(x) is remote_handle.X # typecheck
x.meth(lambda x: x + 10, 6) # remote call, with callback localy
x.meth(remote_handle.f, 3) # remote call, remote callback
remote_handle.sys._getframe(2).f_locals['x'] # remote frame access
# XXX should be 'is x' and shouldn't need (2) argument

# XXX next one does not work, while it should. Too much mangling with remote
# traceback frames probably
try:
  x.meth(1, 2) # non-callable argument, AssertionError
except:
  import sys
  e, c, tb = sys.exc_info()
  import pdb
  pdb.post_mortem(tb)
"""
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.