IPython引擎是独立的进程吗? [英] Are IPython engines independent processes?

查看:144
本文介绍了IPython引擎是独立的进程吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自我们知道的直接提出这个问题:


每个引擎都是自己独立的进程......每个内核都是一个单独的
进程,可以是在任何一台机器上...就像你开始了一个终端IPython会话,每个引擎都是一个单独的IPython会话。如果你在这一个中做a = 5,那个a = 10,这家伙有10个这个人有5个。


这是进一步明确的验证,受到了很好的SE的启发 Hot Network Question on ServerFault,提到使用ProcessExplorer实际跟踪父母儿童进程...


Process Explorer是由Microsoft维护的Sysinternals工具。
可以在进程的
属性对话框中显示进程的命令行以及启动它的父进程,尽管该进程的
名称可能不再可用。
--Corrodias


如果我在另一个命令窗口中触发更多引擎,那么ProcessExplorer的部分就像你看到的完全重复一样在截图中。



只是为了完整性,这里'命令 ipcluster start --n = 5 看起来像......


From the IPython Architecture Overview documentation we know that ...

The IPython engine is a Python instance that takes Python commands over a network connection.

Given that it is a Python instance does that imply that these engines are stand alone processes? I can manually load a set of engines via a command like ipcluster start -n 4. Doing thus is the creation of engines considered the creation of child processes of some parent process or just a means to kick off a set of independent processes that rely on IPC communication to get their work done? I can also invoke an engine via the ipengine command, which is surely standalone as its entered directly to the OS command line with no relation to anything really.

As background I'm trying to drill into how the many IPython engines manipulated through a Client from a python script will interact with another process kicked off in that script.

解决方案

Here's a simple way to find out the processes involved, print the list of current processes before I fire off the controller and engines and then print the list after they're fired off. There's a wmic command to get the job done...

C:\>wmic process get description,executablepath

Interestingly enough the controller gets 5 python processes going, and each engine creates one additional python process. So from this investigation I also learned that an engine is its own process, as well as the controller...

C:\>wmic process get description,executablepath | findstr ipengine
ipengine.exe                   C:\Python34\Scripts\ipengine.exe
ipengine.exe                   C:\Python34\Scripts\ipengine.exe

C:\>wmic process get description,executablepath  | findstr ipcontroller
ipcontroller.exe               C:\Python34\Scripts\ipcontroller.exe

From the looks of it they all seem standalone, though I don't think the OS's running process list carries any information about how the processes are related as far as the parent/child relationship is concerned. That may be a developer only formalism that has no representation that's tracked in the OS, but I don't know about these sort of internals to know either way.

Here's a definitive quote from MinRK that addresses this question directly:

"Every engine is its own isolated process...Each kernel is a separate process and can be on any machine... It's like you started a terminal IPython session, and every engine is a separate IPython session. If you do a=5 in this one, a=10 in that one, this guy has 10 this guy has 5."

Here's further definitive validation, inspired by a great SE Hot Network Question on ServerFault that mentioned use of ProcessExplorer which actually tracks parent child processes...

Process Explorer is a Sysinternals tool maintained by Microsoft. It can display the command line of the process in the process's properties dialog as well as the parent that launched it, though the name of that process may no longer be available. --Corrodias

If I fire off more engines in another command window that section of ProcessExplorer just duplicates exactly as you see in the screenshot.

And just for the sake of completeness, here' what the command ipcluster start --n=5 looks like...

这篇关于IPython引擎是独立的进程吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆