How Python's Decorators and Generators simplify Asynchronous Coding

Date and Time: 
2014 April 24th @ 3pm
Location: 
FL-1022 Large Auditorium
Speaker: 
Joe VanAndel

Controlling and monitoring hardware often requires handling multiple concurrent operations, including querying instruments via remote procedure calls, sending commands to instruments over TCP/IP sockets, and monitoring devices via SNMP, while continuing to respond to status requests. One solution is to write servers with multiple threads that coordinate via semaphores. However, multithreaded Python programs can be difficult to write and debug.

A better approach is to use Twisted, an event driven framework, that allows handling asynchronous operations within a single thread. Twisted supports multiple protocols, including TCP, UDP, SMTP, IMAP, SNMP, HTTP, SSH, XML-RPC, FTP, and IRC.

I will demonstrate how to use Twisted to handle asynchronous operations using callbacks. Next, I will demonstrate how to write asynchronous, “non-blocking”, code that “looks synchronous” using Python’s Decorators and Generators, which greatly simplifies developing and maintaining your code.

Speaker Description: 

Joe VanAndel is a software engineer in the Remote Sensing Facility in EOL. Joe graduated from Calvin College, Grand Rapids, MI with a double major of mathematics and physics in 1978. He earned a Master's degree in Computer Science at University of California at Berkeley in 1980. Joe worked at AT&T Bell Laboratories in Westminster, CO on a real-time operating system called Oryx/Pecos. His next job was with Cadnetix, where he worked on porting Unix to proprietary workstations and servers, computer aided design tools, and software configuration management. In 1988, Joe started working at NCAR/EOL and lead a software team that transformed a prototype weather radar into a research testbed serving the FAA and the National Weather Service. Joe has continued to work with radars and lidars, working on diagnostic software, data acquisition hardware and software, fuzzy logic-based data classification tools, radar control software, web-based user interfaces, data displays, and hardware/software monitoring tools.

Video recorded: 

If you use a non-flash enabled device, you may download the video here

Event Category: