Commit 78f63cd4 authored by Swann Perarnau's avatar Swann Perarnau
Browse files

[feature] Add stdout/stderr streaming

This patch adds stdout/stderr streaming capabilities, based on partial
evaluation of a tornado.iostream callback. The bin/cmd CLI is updated to
wait until an exit message, although that doesn't guaranty anything on
message ordering...

The next step is obviously to figure out a message flow that allows the
CLI to send and receive the command IO properly, in order...
parent 9afe59c7
......@@ -75,8 +75,9 @@ class CommandLineInterface(object):
# ignore other messages
if isinstance(msg, dict) and msg.get('type') == 'container':
if msg['uuid'] == containerid:"container response: %r", msg)
break"container msg: %r", msg)
if msg['event'] == 'exit':
def do_list(self, argv):
"""Connect to the NRM and ask to list the containers present on the
......@@ -2,6 +2,7 @@ from __future__ import print_function
from containers import ContainerManager
from resources import ResourceManager
from functools import partial
import json
import logging
import os
......@@ -129,6 +130,13 @@ class Daemon(object):
# setup io callbacks
elif command == 'kill':"asked to kill container: %r", msg)
response = self.container_manager.kill(msg['uuid'])
......@@ -144,6 +152,18 @@ class Daemon(object):
logger.error("invalid command: %r", command)
def do_children_io(self, uuid, io, data):
"""Receive data from one of the children, and send it down the pipe.
Meant to be partially defined on a children basis.""""%r received %r data: %r", uuid, io, data)
update = {'type': 'container',
'event': io,
'uuid': uuid,
'payload': data or 'eof',
def do_sensor(self):
self.machine_info = self.sensor.do_update()"current state: %r", self.machine_info)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment