##// END OF EJS Templates
update messaging doc with stdin changes...
MinRK -
Show More
1 NO CONTENT: modified file, binary diff hidden
@@ -14,8 +14,8 b''
14 14 height="1052.3622047"
15 15 id="svg2"
16 16 version="1.1"
17 inkscape:version="0.47 r22583"
18 sodipodi:docname="ipython-frontend-kernel.svg"
17 inkscape:version="0.48.2 r9819"
18 sodipodi:docname="frontend-kernel.svg"
19 19 inkscape:export-filename="/home/jtriley/Documents/ipython-frontend-kernel.png"
20 20 inkscape:export-xdpi="90"
21 21 inkscape:export-ydpi="90">
@@ -2956,17 +2956,17 b''
2956 2956 inkscape:pageshadow="2"
2957 2957 inkscape:zoom="0.90509668"
2958 2958 inkscape:cx="256.73404"
2959 inkscape:cy="303.39911"
2959 inkscape:cy="-403.70767"
2960 2960 inkscape:document-units="px"
2961 2961 inkscape:current-layer="layer1"
2962 2962 showgrid="false"
2963 2963 showguides="true"
2964 2964 inkscape:guide-bbox="true"
2965 inkscape:window-width="1440"
2966 inkscape:window-height="825"
2965 inkscape:window-width="1245"
2966 inkscape:window-height="756"
2967 2967 inkscape:window-x="0"
2968 inkscape:window-y="24"
2969 inkscape:window-maximized="1"
2968 inkscape:window-y="0"
2969 inkscape:window-maximized="0"
2970 2970 inkscape:snap-nodes="true" />
2971 2971 <metadata
2972 2972 id="metadata7">
@@ -3022,7 +3022,7 b''
3022 3022 <rect
3023 3023 style="fill:#241c1c;fill-opacity:1"
3024 3024 id="rect4235"
3025 width="151.52289"
3025 width="180"
3026 3026 height="92.934036"
3027 3027 x="43.015251"
3028 3028 y="565.53973"
@@ -3032,7 +3032,7 b''
3032 3032 <rect
3033 3033 style="fill:#008000;fill-opacity:1"
3034 3034 id="rect4235-2"
3035 width="151.52289"
3035 width="180"
3036 3036 height="92.934036"
3037 3037 x="285.4671"
3038 3038 y="565.53973"
@@ -3052,7 +3052,7 b''
3052 3052 <text
3053 3053 xml:space="preserve"
3054 3054 style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
3055 x="75.632164"
3055 x="49.632164"
3056 3056 y="624.2724"
3057 3057 id="text4268"
3058 3058 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
@@ -3060,13 +3060,13 b''
3060 3060 inkscape:export-ydpi="90"><tspan
3061 3061 sodipodi:role="line"
3062 3062 id="tspan4270"
3063 x="75.632164"
3063 x="49.632164"
3064 3064 y="624.2724"
3065 style="fill:#ffffff">REQ</tspan></text>
3065 style="fill:#ffffff">ROUTER</tspan></text>
3066 3066 <text
3067 3067 xml:space="preserve"
3068 3068 style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
3069 x="308.98245"
3069 x="292.98245"
3070 3070 y="626.58685"
3071 3071 id="text4268-9"
3072 3072 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
@@ -3074,9 +3074,9 b''
3074 3074 inkscape:export-ydpi="90"><tspan
3075 3075 sodipodi:role="line"
3076 3076 id="tspan4270-1"
3077 x="308.98245"
3077 x="292.98245"
3078 3078 y="626.58685"
3079 style="fill:#ffffff">XREP</tspan></text>
3079 style="fill:#ffffff">ROUTER</tspan></text>
3080 3080 <text
3081 3081 xml:space="preserve"
3082 3082 style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
@@ -3148,13 +3148,14 b''
3148 3148 y="222.01678" /></flowRegion><flowPara
3149 3149 id="flowPara3620"
3150 3150 style="font-size:28px;font-weight:bold">Front-end</flowPara></flowRoot> <path
3151 style="fill:#05ff00;stroke:#2af510;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1"
3151 style="fill:#05ff00;fill-opacity:1;stroke:#2af510;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
3152 3152 d="m 373.73648,243.10253 -0.11904,-45.00016"
3153 3153 id="path3711"
3154 3154 inkscape:connector-type="polyline"
3155 3155 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3156 3156 inkscape:export-xdpi="90"
3157 inkscape:export-ydpi="90" />
3157 inkscape:export-ydpi="90"
3158 inkscape:connector-curvature="0" />
3158 3159 <rect
3159 3160 style="fill:#00ff00;fill-opacity:1"
3160 3161 id="rect3884"
@@ -3192,7 +3193,7 b''
3192 3193 <text
3193 3194 xml:space="preserve"
3194 3195 style="font-size:40px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
3195 x="454.03732"
3196 x="444.03732"
3196 3197 y="345.68896"
3197 3198 id="text4861-2"
3198 3199 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
@@ -3200,9 +3201,9 b''
3200 3201 inkscape:export-ydpi="90"><tspan
3201 3202 sodipodi:role="line"
3202 3203 id="tspan4863-6"
3203 x="454.03732"
3204 x="444.03732"
3204 3205 y="345.68896"
3205 style="font-size:28px;fill:#ffffff">REP</tspan></text>
3206 style="font-size:28px;fill:#ffffff">DEAL</tspan></text>
3206 3207 <rect
3207 3208 style="fill:#ff0000;fill-opacity:1"
3208 3209 id="rect4859-9-4"
@@ -3250,7 +3251,7 b''
3250 3251 id="tspan4863-6-97"
3251 3252 x="239.47998"
3252 3253 y="344.35312"
3253 style="font-size:28px;fill:#ffffff">XREQ</tspan></text>
3254 style="font-size:28px;fill:#ffffff">DEAL</tspan></text>
3254 3255 <rect
3255 3256 style="fill:#0000ff;fill-rule:evenodd;stroke:#000000;stroke-width:0.80252945px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
3256 3257 id="rect2816-3"
@@ -3281,7 +3282,8 b''
3281 3282 style="fill:none;stroke:#06ff00;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
3282 3283 d="m 728.27256,243.10253 -0.1191,-45.00015"
3283 3284 id="path3711-4"
3284 inkscape:connector-type="polyline" />
3285 inkscape:connector-type="polyline"
3286 inkscape:connector-curvature="0" />
3285 3287 <rect
3286 3288 style="fill:#00ff00;fill-opacity:1"
3287 3289 id="rect3884-4"
@@ -3335,7 +3337,7 b''
3335 3337 id="tspan4863-6-97-6"
3336 3338 x="631.95612"
3337 3339 y="344.35312"
3338 style="font-size:28px;fill:#ffffff">XREQ</tspan></text>
3340 style="font-size:28px;fill:#ffffff">DEAL</tspan></text>
3339 3341 <rect
3340 3342 style="fill:#0000ff;fill-rule:evenodd;stroke:#000000;stroke-width:0.80252945px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
3341 3343 id="rect2816-3-6"
@@ -3367,7 +3369,8 b''
3367 3369 d="m 37.276897,243.10252 -0.11904,-45.00015"
3368 3370 id="path3711-4-8"
3369 3371 inkscape:connector-type="polyline"
3370 sodipodi:nodetypes="cc" />
3372 sodipodi:nodetypes="cc"
3373 inkscape:connector-curvature="0" />
3371 3374 <rect
3372 3375 style="fill:#00ff00;fill-opacity:1"
3373 3376 id="rect3884-4-1"
@@ -3421,10 +3424,10 b''
3421 3424 id="tspan4863-6-97-6-1"
3422 3425 x="-59.039528"
3423 3426 y="344.35312"
3424 style="font-size:28px;fill:#ffffff">XREQ</tspan></text>
3427 style="font-size:28px;fill:#ffffff">DEAL</tspan></text>
3425 3428 <path
3426 3429 style="fill:#ff0000;stroke:#ff0000;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-mid:url(#Arrow1Mstart)"
3427 d="m 123.8316,357.91004 355.72174,187.40953 50.81739,26.77279"
3430 d="M 123.8316,357.91004 530.37073,572.09236"
3428 3431 id="path10788"
3429 3432 inkscape:connector-type="polyline"
3430 3433 inkscape:connection-start="#rect4859-9-4-5-6"
@@ -3432,10 +3435,13 b''
3432 3435 sodipodi:nodetypes="ccc"
3433 3436 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3434 3437 inkscape:export-xdpi="90"
3435 inkscape:export-ydpi="90" />
3438 inkscape:export-ydpi="90"
3439 inkscape:connection-start-point="d4"
3440 inkscape:connection-end-point="d4"
3441 inkscape:connector-curvature="0" />
3436 3442 <path
3437 3443 style="fill:#d40000;fill-opacity:1;stroke:#ff0000;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-mid:url(#Arrow1Mstart)"
3438 d="M 759.43823,357.91004 696.80284,461.72488 634.16746,565.53973"
3444 d="M 759.43823,357.91004 634.16746,565.53973"
3439 3445 id="path10790"
3440 3446 inkscape:connector-type="polyline"
3441 3447 inkscape:connection-start="#rect4859-9-4-5"
@@ -3443,10 +3449,13 b''
3443 3449 sodipodi:nodetypes="ccc"
3444 3450 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3445 3451 inkscape:export-xdpi="90"
3446 inkscape:export-ydpi="90" />
3452 inkscape:export-ydpi="90"
3453 inkscape:connection-start-point="d4"
3454 inkscape:connection-end-point="d4"
3455 inkscape:connector-curvature="0" />
3447 3456 <path
3448 3457 style="fill:none;stroke:#278900;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-mid:url(#Arrow1Mstart)"
3449 d="M 10.376699,357.91004 297.06778,565.53973"
3458 d="M 11.518036,357.91004 308.91123,565.53973"
3450 3459 id="path10792"
3451 3460 inkscape:connector-type="polyline"
3452 3461 inkscape:connection-start="#rect4859-9-3-5-8"
@@ -3454,10 +3463,13 b''
3454 3463 sodipodi:nodetypes="ccc"
3455 3464 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3456 3465 inkscape:export-xdpi="90"
3457 inkscape:export-ydpi="90" />
3466 inkscape:export-ydpi="90"
3467 inkscape:connection-start-point="d4"
3468 inkscape:connection-end-point="d4"
3469 inkscape:connector-curvature="0" />
3458 3470 <path
3459 3471 style="fill:#008000;fill-opacity:1;stroke:#238800;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-mid:url(#Arrow1Mstart)"
3460 d="M 645.98339,357.91004 413.30206,565.53973"
3472 d="M 647.12473,357.91004 425.14551,565.53973"
3461 3473 id="path10794"
3462 3474 inkscape:connector-type="polyline"
3463 3475 inkscape:connection-start="#rect4859-9-3-5"
@@ -3465,10 +3477,13 b''
3465 3477 sodipodi:nodetypes="ccc"
3466 3478 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3467 3479 inkscape:export-xdpi="90"
3468 inkscape:export-ydpi="90" />
3480 inkscape:export-ydpi="90"
3481 inkscape:connection-start-point="d4"
3482 inkscape:connection-end-point="d4"
3483 inkscape:connector-curvature="0" />
3469 3484 <path
3470 3485 style="fill:none;stroke:#ff0000;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-mid:url(#Arrow1Mstart)"
3471 d="m 398.42235,357.91004 127.29423,155.72226 42.43141,51.90743"
3486 d="M 398.42235,357.91004 568.14799,565.53973"
3472 3487 id="path10796"
3473 3488 inkscape:connector-type="polyline"
3474 3489 inkscape:connection-start="#rect4859-9-4"
@@ -3476,10 +3491,13 b''
3476 3491 sodipodi:nodetypes="ccc"
3477 3492 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3478 3493 inkscape:export-xdpi="90"
3479 inkscape:export-ydpi="90" />
3494 inkscape:export-ydpi="90"
3495 inkscape:connection-start-point="d4"
3496 inkscape:connection-end-point="d4"
3497 inkscape:connector-curvature="0" />
3480 3498 <path
3481 3499 style="fill:#280b0b;stroke:#000000;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-mid:none"
3482 d="M 179.80746,565.53973 452.88606,357.62577"
3500 d="M 191.65337,565.53973 454.02622,357.62577"
3483 3501 id="path10800"
3484 3502 inkscape:connector-type="polyline"
3485 3503 inkscape:connection-start="#rect4235"
@@ -3487,10 +3505,13 b''
3487 3505 sodipodi:nodetypes="ccc"
3488 3506 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3489 3507 inkscape:export-xdpi="90"
3490 inkscape:export-ydpi="90" />
3508 inkscape:export-ydpi="90"
3509 inkscape:connection-start-point="d4"
3510 inkscape:connection-end-point="d4"
3511 inkscape:connector-curvature="0" />
3491 3512 <path
3492 3513 style="fill:#ff0000;stroke:#449900;stroke-width:4;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-mid:url(#Arrow1Mend)"
3493 d="M 347.28257,565.53973 284.96744,357.91004"
3514 d="M 359.12602,565.53973 286.10878,357.91004"
3494 3515 id="path10802"
3495 3516 inkscape:connector-type="polyline"
3496 3517 inkscape:connection-start="#rect4235-2"
@@ -3498,7 +3519,10 b''
3498 3519 sodipodi:nodetypes="ccc"
3499 3520 inkscape:export-filename="/home/jtriley/Documents/path10411-0-4-9.png"
3500 3521 inkscape:export-xdpi="90"
3501 inkscape:export-ydpi="90" />
3522 inkscape:export-ydpi="90"
3523 inkscape:connection-start-point="d4"
3524 inkscape:connection-end-point="d4"
3525 inkscape:connector-curvature="0" />
3502 3526 <rect
3503 3527 style="fill:#000000;fill-opacity:1;stroke:none"
3504 3528 id="rect11963"
@@ -6717,20 +6741,28 b''
6717 6741 id="path6285"
6718 6742 inkscape:connector-type="polyline"
6719 6743 inkscape:connection-start="#rect4497"
6720 inkscape:connection-end="#rect3695" />
6744 inkscape:connection-end="#rect3695"
6745 inkscape:connection-start-point="d4"
6746 inkscape:connection-end-point="d4"
6747 inkscape:connector-curvature="0" />
6721 6748 <path
6722 style="fill:none;stroke:#07ff00;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
6749 style="fill:none;stroke:#07ff00;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
6723 6750 d="m 728.98863,98.204487 0.69887,46.345193"
6724 6751 id="path7136"
6725 6752 inkscape:connector-type="polyline"
6726 inkscape:connection-start="#g6750" />
6753 inkscape:connection-start="#g6750"
6754 inkscape:connection-start-point="d4"
6755 inkscape:connector-curvature="0" />
6727 6756 <path
6728 style="fill:none;stroke:#06ff00;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
6757 style="fill:none;stroke:#06ff00;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
6729 6758 d="m 37.066258,97.891987 0.09752,46.781813"
6730 6759 id="path5028"
6731 6760 inkscape:connector-type="polyline"
6732 6761 inkscape:connection-end="#rect3695-4-1"
6733 inkscape:connection-start="#g4874" />
6762 inkscape:connection-start="#g4874"
6763 inkscape:connection-start-point="d4"
6764 inkscape:connection-end-point="d4"
6765 inkscape:connector-curvature="0" />
6734 6766 <path
6735 6767 style="fill:none;stroke:#000000;stroke-width:3.20000005;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:url(#Arrow1Send-9);marker-mid:none;marker-end:url(#Arrow1Mend)"
6736 6768 d="m 97.76109,405.78583 c 49.81163,34.41382 20.9084,50.49106 -23.630766,17.69543"
@@ -31,30 +31,30 b' The basic design is explained in the following diagram:'
31 31 A single kernel can be simultaneously connected to one or more frontends. The
32 32 kernel has three sockets that serve the following functions:
33 33
34 1. REQ: this socket is connected to a *single* frontend at a time, and it allows
35 the kernel to request input from a frontend when :func:`raw_input` is called.
36 The frontend holding the matching REP socket acts as a 'virtual keyboard'
34 1. stdin: this ROUTER socket is connected to all frontends, and it allows
35 the kernel to request input from the active frontend when :func:`raw_input` is called.
36 The frontend that executed the code has a DEALER socket that acts as a 'virtual keyboard'
37 37 for the kernel while this communication is happening (illustrated in the
38 38 figure by the black outline around the central keyboard). In practice,
39 39 frontends may display such kernel requests using a special input widget or
40 40 otherwise indicating that the user is to type input for the kernel instead
41 41 of normal commands in the frontend.
42 42
43 2. ROUTER: this single sockets allows multiple incoming connections from
43 2. Shell: this single ROUTER socket allows multiple incoming connections from
44 44 frontends, and this is the socket where requests for code execution, object
45 45 information, prompts, etc. are made to the kernel by any frontend. The
46 46 communication on this socket is a sequence of request/reply actions from
47 47 each frontend and the kernel.
48 48
49 3. PUB: this socket is the 'broadcast channel' where the kernel publishes all
49 3. IOPub: this socket is the 'broadcast channel' where the kernel publishes all
50 50 side effects (stdout, stderr, etc.) as well as the requests coming from any
51 client over the ROUTER socket and its own requests on the REP socket. There
51 client over the shell socket and its own requests on the stdin socket. There
52 52 are a number of actions in Python which generate side effects: :func:`print`
53 53 writes to ``sys.stdout``, errors generate tracebacks, etc. Additionally, in
54 54 a multi-client scenario, we want all frontends to be able to know what each
55 55 other has sent to the kernel (this can be useful in collaborative scenarios,
56 56 for example). This socket allows both side effects and the information
57 about communications taking place with one client over the ROUTER/DEALER channel
57 about communications taking place with one client over the shell channel
58 58 to be made available to all clients in a uniform manner.
59 59
60 60 All messages are tagged with enough information (details below) for clients
@@ -126,8 +126,8 b' For each message type, the actual content will differ and all existing message'
126 126 types are specified in what follows of this document.
127 127
128 128
129 Messages on the ROUTER/DEALER socket
130 ================================
129 Messages on the shell ROUTER/DEALER sockets
130 ===========================================
131 131
132 132 .. _execute:
133 133
@@ -162,6 +162,12 b' Message type: ``execute_request``::'
162 162 # Similarly, a dict mapping names to expressions to be evaluated in the
163 163 # user's dict.
164 164 'user_expressions' : dict,
165
166 # Some frontends (e.g. the Notebook) do not support stdin requests. If
167 # raw_input is called from code executed from such a frontend, a
168 # StdinNotImplementedError will be raised.
169 'allow_stdin' : True,
170
165 171 }
166 172
167 173 The ``code`` field contains a single string (possibly multiline). The kernel
@@ -637,7 +643,7 b' Connect'
637 643 When a client connects to the request/reply socket of the kernel, it can issue
638 644 a connect request to get basic information about the kernel, such as the ports
639 645 the other ZeroMQ sockets are listening on. This allows clients to only have
640 to know about a single port (the DEALER/ROUTER channel) to connect to a kernel.
646 to know about a single port (the shell channel) to connect to a kernel.
641 647
642 648 Message type: ``connect_request``::
643 649
@@ -647,9 +653,9 b' Message type: ``connect_request``::'
647 653 Message type: ``connect_reply``::
648 654
649 655 content = {
650 'xrep_port' : int # The port the ROUTER socket is listening on.
651 'pub_port' : int # The port the PUB socket is listening on.
652 'req_port' : int # The port the REQ socket is listening on.
656 'shell_port' : int # The port the shell ROUTER socket is listening on.
657 'iopub_port' : int # The port the PUB socket is listening on.
658 'stdin_port' : int # The port the stdin ROUTER socket is listening on.
653 659 'hb_port' : int # The port the heartbeat socket is listening on.
654 660 }
655 661
@@ -863,15 +869,17 b' Message type: ``file``::'
863 869 'data' : str,
864 870 }
865 871
866
867 Messages on the REQ/REP socket
868 ==============================
869 872
870 This is a socket that goes in the opposite direction: from the kernel to a
871 *single* frontend, and its purpose is to allow ``raw_input`` and similar
872 operations that read from ``sys.stdin`` on the kernel to be fulfilled by the
873 client. For now we will keep these messages as simple as possible, since they
874 basically only mean to convey the ``raw_input(prompt)`` call.
873 Messages on the stdin ROUTER/DEALER sockets
874 ===========================================
875
876 This is a socket where the request/reply pattern goes in the opposite direction:
877 from the kernel to a *single* frontend, and its purpose is to allow
878 ``raw_input`` and similar operations that read from ``sys.stdin`` on the kernel
879 to be fulfilled by the client. The request should be made to the frontend that
880 made the execution request that prompted ``raw_input`` to be called. For now we
881 will keep these messages as simple as possible, since they only mean to convey
882 the ``raw_input(prompt)`` call.
875 883
876 884 Message type: ``input_request``::
877 885
General Comments 0
You need to be logged in to leave comments. Login now