Pass pyflakes.

This commit is contained in:
Bob Lantz
2010-05-04 19:11:12 -07:00
parent c79882b766
commit 259d713315
10 changed files with 157 additions and 106 deletions
+1 -2
View File
@@ -28,9 +28,8 @@ and bandwidth ('iperf'.)
from subprocess import call
from cmd import Cmd
from os import isatty
from select import poll, select, POLLIN
from select import poll, POLLIN
from sys import stdin
from tty import setcbreak
from mininet.log import info, output, error
from mininet.term import makeTerms
+9 -4
View File
@@ -397,10 +397,12 @@ class Mininet( object ):
self.stop()
return result
def monitor( self, hosts=None ):
def monitor( self, hosts=None, timeoutms=-1 ):
"""Monitor a set of hosts (or all hosts by default),
and return their output, a line at a time.
returns: host, line"""
hosts: (optional) set of hosts to monitor
timeoutms: (optional) timeout value in ms
returns: iterator which returns host, line"""
if hosts is None:
hosts = self.hosts
poller = select.poll()
@@ -408,13 +410,16 @@ class Mininet( object ):
for host in hosts:
poller.register( host.stdout )
while True:
ready = poller.poll()
ready = poller.poll( timeoutms )
for fd, event in ready:
host = Node.fdToNode( fd )
if event & select.POLLIN:
line = host.readline()
if line:
if line is not None:
yield host, line
# Return if non-blocking
if not ready and timeoutms >= 0:
yield None, None
@staticmethod
def _parsePing( pingOutput ):