有没有类似于分布式Ruby的Python模块

发布于 2024-08-09 08:00:24 字数 71 浏览 9 评论 0原文

我是Python新手。只是想知道python中有没有类似于ruby的drb的模块?就像客户端可以使用drb服务器提供的对象一样?

I am new to Python. Just want to know is there any module in python similar to ruby's drb? Like a client can use object provided by the drb server?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

小耗子 2024-08-16 08:00:24

这通常称为“对象代理”,可以通过浏览 Python 包索引 此处

其中最古老且使用最广泛的是 Pyro

This is generally called "object brokering" and a list of some Python packages in this area can be found by browsing the Object Brokering topic area of the Python Package Index here.

The oldest and most widely used of these is Pyro.

无力看清 2024-08-16 08:00:24

Pyro 执行我认为您所描述的操作(尽管我没有使用过 drb)。

来自网站:

Pyro 是 PYthon Remote Objects 的缩写。它是一个完全用 Python 编写的先进且强大的分布式对象技术系统,其设计非常易于使用。再也不用担心编写网络通信代码了,使用 Pyro 时,您只需像平常一样编写 Python 对象即可。只需几行额外代码,一旦您将对象分割到网络上的不同机器上,Pyro 就会负责对象之间的网络通信。所有血淋淋的套接字编程细节都已处理完毕,您只需调用远程对象上的方法,就好像它是本地对象一样!

Pyro does what I think you're discribing (although I've not used drb).

From the website:

Pyro is short for PYthon Remote Objects. It is an advanced and powerful Distributed Object Technology system written entirely in Python, that is designed to be very easy to use. Never worry about writing network communication code again, when using Pyro you just write your Python objects like you would normally. With only a few lines of extra code, Pyro takes care of the network communication between your objects once you split them over different machines on the network. All the gory socket programming details are taken care of, you just call a method on a remote object as if it were a local object!

一桥轻雨一伞开 2024-08-16 08:00:24

标准的 multiprocessing 模块可能会做你想做的事情。

The standard multiprocessing module might do what you want.

留一抹残留的笑 2024-08-16 08:00:24

我不知道 drb 是什么,但从你提供的少量信息来看,
它可能类似于 Twisted 中的 Perspective Broker

简介

假设您发现自己处于掌控之中
电线两端:你有两个
需要互相对话的程序
其他,你可以使用任何协议
你想要的。如果你能想到你的
需要的对象方面的问题
相互进行方法调用,
那么你很有可能可以使用
twisted 的 Perspective Broker 协议
而不是试图硬塞你的
需要像 HTTP 这样的东西,或者
实施另一个 RPC
机制。

透视经纪人系统
(缩写PB,产卵众多
与三明治相关的双关语)是基于
几个核心概念:

序列化:相当随意
对象和类型,将它们变成
字节块,通过
线,然后在
另一端。通过仔细跟踪
对象 ID,序列化对象可以
包含对其他对象的引用
并且远程副本仍将是
有用。

远程方法调用:执行
本地对象的某些内容和
导致方法在 a 上运行
遥远的一个。本地对象是
称为 RemoteReference,并且您可以
通过运行 .callRemote 来执行某些操作
方法。

I have no idea what drb is, but from the little information you have given,
it might be something like the Perspective Broker in Twisted

Introduction

Suppose you find yourself in control
of both ends of the wire: you have two
programs that need to talk to each
other, and you get to use any protocol
you want. If you can think of your
problem in terms of objects that need
to make method calls on each other,
then chances are good that you can use
twisted's Perspective Broker protocol
rather than trying to shoehorn your
needs into something like HTTP, or
implementing yet another RPC
mechanism.

The Perspective Broker system
(abbreviated PB, spawning numerous
sandwich-related puns) is based upon a
few central concepts:

serialization: taking fairly arbitrary
objects and types, turning them into a
chunk of bytes, sending them over a
wire, then reconstituting them on the
other end. By keeping careful track of
object ids, the serialized objects can
contain references to other objects
and the remote copy will still be
useful.

remote method calls: doing
something to a local object and
causing a method to get run on a
distant one. The local object is
called a RemoteReference, and you do
something by running its .callRemote
method.

风追烟花雨 2024-08-16 08:00:24

你看过execnet吗?

http://codespeak.net/execnet/

Have you looked at execnet?

http://codespeak.net/execnet/

无戏配角 2024-08-16 08:00:24

对于并行处理和分布式计算,我使用 并行 python

For parallel processing and distributed computing I use parallel python.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文