Efficient Threading

2014-11-14 Thread Empty Account
Hi,

I am thinking about writing a load test tool in Python, so I am interested
in how I can create the most concurrent threads/processes with the fewest
OS resources. I would imagine that I/O would need to be non-blocking.

There are a number of options including standard library threading, gevent,
stackless python, cython parallelism etc. Because I am new to Python, I am
unsure on which libraries to choose. I am not really bothered on the tool
chain, just as long as it is Python related (so I'd use PyPy for example).

Many Thanks

Aidy
-- 
https://mail.python.org/mailman/listinfo/python-list


Flush stdin

2014-10-18 Thread Empty Account
Hi,

I am using netcat to listen to a port and python to read stdin and print to
the console.

nc -l 2003 | python print_metrics.py

sys.stdin.flush() doesn’t seem to flush stdin, so I am using the termios
module.

while True:
   input = sys.stdin.readline()
   # do some parsing
   …
   sys.stdout.write(parsed_data)
   time.sleep(3)
   termios.tcflush(sys.stdin, termios.TCIOFLUSH)


I am receiving this exception
termios.error: (25, 'Inappropriate ioctl for device')


I will be using this script on Unix based systems and I wondered what
approach I could use
to flush stdin?

Many Thanks

Aidy
-- 
https://mail.python.org/mailman/listinfo/python-list