Popular Python recipes tagged "distributed"http://code.activestate.com/recipes/langs/python/tags/distributed/2013-12-01T11:19:56-08:00ActiveState Code RecipesDistributed lock manager for Python (Python)
2012-07-04T21:03:32-07:00pavelhttp://code.activestate.com/recipes/users/4171837/http://code.activestate.com/recipes/578194-distributed-lock-manager-for-python/
<p style="color: grey">
Python
recipe 578194
by <a href="/recipes/users/4171837/">pavel</a>
(<a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/lock/">lock</a>, <a href="/recipes/tags/locking/">locking</a>, <a href="/recipes/tags/locks/">locks</a>, <a href="/recipes/tags/manager/">manager</a>, <a href="/recipes/tags/socket/">socket</a>, <a href="/recipes/tags/thread/">thread</a>, <a href="/recipes/tags/threading/">threading</a>, <a href="/recipes/tags/wsgi/">wsgi</a>).
Revision 2.
</p>
<p>Distributed lock manager provides mutex(es) over network. It is used to synchronize processes running on different machines, e.g. WSGI processes in case of web applications. Lock object is compatible with threading.Lock and can be used as a context manager ("with statement"). It can be easily modified to use UNIX sockets instead of TCP/IP. Communication protocol is text based.</p>
<p>First start server process:</p>
<pre class="prettyprint"><code>$ chmod +x dlm.py
$ ./dlm.py
</code></pre>
<p>Usage:</p>
<pre class="prettyprint"><code>from dlm import LockClient
client = LockClient('localhost', 27272, 'client_name')
lock = client.mkLock('lock_name')
lock.acquire()
# critical section here...
lock.release()
# using context manager
with lock:
# critical section here...
</code></pre>
DistCC 'top' (Python)
2013-12-01T11:19:56-08:00Mike 'Fuzzy' Partinhttp://code.activestate.com/recipes/users/4179778/http://code.activestate.com/recipes/577933-distcc-top/
<p style="color: grey">
Python
recipe 577933
by <a href="/recipes/users/4179778/">Mike 'Fuzzy' Partin</a>
(<a href="/recipes/tags/color/">color</a>, <a href="/recipes/tags/curses/">curses</a>, <a href="/recipes/tags/distcc/">distcc</a>, <a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/monitor/">monitor</a>, <a href="/recipes/tags/pack/">pack</a>, <a href="/recipes/tags/struct/">struct</a>, <a href="/recipes/tags/top/">top</a>, <a href="/recipes/tags/unpack/">unpack</a>).
Revision 3.
</p>
<p>A small recipe for a curses based, 'top'-like monitor for DistCC. I know there is already distccmon-text, but I don't like it, and much prefer this sytle of monitoring. Note that I don't keep hosts around in the list like distccmon-gui/gnome. The screen is drawn for exactly what is currently in state. The terminal size is respected at initialization time, however resize events aren't handled. There is color designation of job types.</p>
LoggingWebMonitor - a central logging server and monitor. (Python)
2010-02-02T01:56:42-08:00Gabriel Genellinahttp://code.activestate.com/recipes/users/924636/http://code.activestate.com/recipes/577025-loggingwebmonitor-a-central-logging-server-and-mon/
<p style="color: grey">
Python
recipe 577025
by <a href="/recipes/users/924636/">Gabriel Genellina</a>
(<a href="/recipes/tags/client_server/">client_server</a>, <a href="/recipes/tags/debugging/">debugging</a>, <a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/logging/">logging</a>, <a href="/recipes/tags/remote/">remote</a>, <a href="/recipes/tags/sysadmin/">sysadmin</a>, <a href="/recipes/tags/web/">web</a>).
Revision 3.
</p>
<p>LoggingWebMonitor listens for log records sent from other processes running in the same box or network. Collects and saves them concurrently in a log file. Shows a summary web page with the latest N records received.</p>
Pickle Optimizer (Python)
2008-02-11T19:43:15-08:00Raymond Hettingerhttp://code.activestate.com/recipes/users/178123/http://code.activestate.com/recipes/545418-pickle-optimizer/
<p style="color: grey">
Python
recipe 545418
by <a href="/recipes/users/178123/">Raymond Hettinger</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
Revision 2.
</p>
<p>Smaller faster pickles! Eliminates unused PUT opcodes.</p>
An Erlang Port in Python (Python)
2010-02-18T06:47:09-08:00thanos vassilakishttp://code.activestate.com/recipes/users/4048784/http://code.activestate.com/recipes/534162-an-erlang-port-in-python/
<p style="color: grey">
Python
recipe 534162
by <a href="/recipes/users/4048784/">thanos vassilakis</a>
(<a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/erlang/">erlang</a>, <a href="/recipes/tags/integration/">integration</a>, <a href="/recipes/tags/process/">process</a>).
Revision 3.
</p>
<p>Erlang has two built-in interoperability mechanisms. One is distributed Erlang nodes and the other one is ports.
Ports provide the basic Erlang mechanism for communication with the external world. They provide a byte-oriented interface to an external program. When a port has been created, Erlang can communicate with it by sending and receiving lists of bytes. This recipe cooks an Erlang port in python. Making it easy for Erlang to instantiate and use python objects. Like most simple port implementations it uses an external python program and lets Erlang communicate via standard input and write to standard output. Theoretically, the external program could be written in any programming language. This recipe is pretty abstract and you will have to implement your own encode and decoding scheme.</p>
Render farm script (Python)
2006-08-22T09:10:49-07:00Will Warehttp://code.activestate.com/recipes/users/126911/http://code.activestate.com/recipes/496982-render-farm-script/
<p style="color: grey">
Python
recipe 496982
by <a href="/recipes/users/126911/">Will Ware</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>This script runs a render farm on a bunch of networked machines, each with SSHD running, and POV-Ray and ImageMagick installed. The host machine uses mpeg2encode and ffmpeg to produce a MP4 video file, which I transfer to the Mac to burn a DVD. To keep life simple, I clone the same .ssh directory on all the machines.</p>
web sevice usage via a http proxy (Python)
2006-02-13T07:09:58-08:00Sebastian Schneckenerhttp://code.activestate.com/recipes/users/2775366/http://code.activestate.com/recipes/473883-web-sevice-usage-via-a-http-proxy/
<p style="color: grey">
Python
recipe 473883
by <a href="/recipes/users/2775366/">Sebastian Schneckener</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>This is a simple example of web service usage (here: currency exchange rate service from xmethods) in python via a http proxy. Proxy information is taken from the environment.</p>
Simple object distribution (Python)
2005-11-27T17:25:02-08:00Igor Cananeahttp://code.activestate.com/recipes/users/2682069/http://code.activestate.com/recipes/457669-simple-object-distribution/
<p style="color: grey">
Python
recipe 457669
by <a href="/recipes/users/2682069/">Igor Cananea</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>Distribute already (or newly) implemented Python objects, allowing them to be remotely accessed without much hussle</p>
Simple Threaded XML-RPC Server (Python)
2005-06-08T08:26:29-07:00Guyon Moréehttp://code.activestate.com/recipes/users/2475983/http://code.activestate.com/recipes/425043-simple-threaded-xml-rpc-server/
<p style="color: grey">
Python
recipe 425043
by <a href="/recipes/users/2475983/">Guyon Morée</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
Revision 3.
</p>
<p>Make the standard-lib SimpleXMLRPCServer multi-threaded by using a simple mix-in construction.</p>
serving dynamically-generated PDF files via XML/RPC (Python)
2005-05-05T23:41:15-07:00gian paolo cicerihttp://code.activestate.com/recipes/users/631476/http://code.activestate.com/recipes/413404-serving-dynamically-generated-pdf-files-via-xmlrpc/
<p style="color: grey">
Python
recipe 413404
by <a href="/recipes/users/631476/">gian paolo ciceri</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>It's only a matter to put together Reportlab to generate a pdf file on the fly and Cherrypy xmlrpc filter to serve it as an XML/RPC binary object (base64-encoded).</p>
Exposing a COM component as a web service via XMLRPC with CherryPy (windows-specific) (Python)
2004-11-23T10:36:18-08:00gian paolo cicerihttp://code.activestate.com/recipes/users/631476/http://code.activestate.com/recipes/347209-exposing-a-com-component-as-a-web-service-via-xmlr/
<p style="color: grey">
Python
recipe 347209
by <a href="/recipes/users/631476/">gian paolo ciceri</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
Revision 5.
</p>
<p>This recipe shows how to build an xmlrpc multithread server that exposes a COM component as a web service.</p>
Exposing a Pyro remote object as a web service via XMLRPC with CherryPy (Python)
2004-11-23T02:50:16-08:00gian paolo cicerihttp://code.activestate.com/recipes/users/631476/http://code.activestate.com/recipes/347210-exposing-a-pyro-remote-object-as-a-web-service-via/
<p style="color: grey">
Python
recipe 347210
by <a href="/recipes/users/631476/">gian paolo ciceri</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>This recipe shows how to build an xmlrpc multithread server that exposes a Pyro remote object as a web service. Be careful to the remote object state: two different ways (a global and a thread local) are shown.</p>
Implement a CORBA client and server (Python)
2002-06-05T20:27:38-07:00Duncan Grisbyhttp://code.activestate.com/recipes/users/111963/http://code.activestate.com/recipes/81254-implement-a-corba-client-and-server/
<p style="color: grey">
Python
recipe 81254
by <a href="/recipes/users/111963/">Duncan Grisby</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
Revision 2.
</p>
<p>CORBA has a reputation for being hard to use, but it is really very easy, expecially if you use Python. This example shows the complete implementation of a fortune cookie server and its client.</p>
Distributed request/reply middleware architecture. (Python)
2001-10-14T01:39:22-07:00Graham Dumpletonhttp://code.activestate.com/recipes/users/135831/http://code.activestate.com/recipes/81615-distributed-requestreply-middleware-architecture/
<p style="color: grey">
Python
recipe 81615
by <a href="/recipes/users/135831/">Graham Dumpleton</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>Simple example of setting up a distributed message oriented request/reply architecture. Shows creation of a central exchange service which all participating processes connect to. Services assign themselves a name and export the methods which are remotely accessible. Client services are then able to make calls against the exported methods.</p>
Distributed publish/subscribe middleware architecture. (Python)
2001-10-14T01:18:27-07:00Graham Dumpletonhttp://code.activestate.com/recipes/users/135831/http://code.activestate.com/recipes/81614-distributed-publishsubscribe-middleware-architectu/
<p style="color: grey">
Python
recipe 81614
by <a href="/recipes/users/135831/">Graham Dumpleton</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>Simple example of setting up a distributed publish/subscribe system. Shows creation of a central exchange service which all participating processes connect to. Services can then set themselves up as publishers, with other services able to subscribe to what is being published.</p>
Message Passing With Socket Datagrams (Python)
2001-03-11T11:32:48-08:00Jeff Bauerhttp://code.activestate.com/recipes/users/98055/http://code.activestate.com/recipes/52218-message-passing-with-socket-datagrams/
<p style="color: grey">
Python
recipe 52218
by <a href="/recipes/users/98055/">Jeff Bauer</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>Sending short text messages with socket datagrams is simple
to implement and provides a very lightweight message passing
idiom.</p>
XML-RPC with Medusa (Python)
2001-03-11T11:41:00-08:00Jeff Bauerhttp://code.activestate.com/recipes/users/98055/http://code.activestate.com/recipes/52226-xml-rpc-with-medusa/
<p style="color: grey">
Python
recipe 52226
by <a href="/recipes/users/98055/">Jeff Bauer</a>
(<a href="/recipes/tags/distributed/">distributed</a>).
</p>
<p>This section demonstrates remote method calls between two
machines (or processes) using the XML-RPC protocol. A complete
example of working client/server code is provided.</p>