Chapter 11Control and Automation
The final step to fully streamline your research laboratory is to manage the execution of your laboratory processes. In this chapter we’ll discuss how to invoke tasks remotely, on a schedule, and in response to file system changes, such as when a data file is created. We’ll also describe current best practices for coordinating multiple concurrent tasks, which might be necessary for processing a large number of data files through a sequence of programs, or correctly executing an assay by coordinating multiple instruments like a robot or autosampler with other automated instruments like an analytical balance or microplate reader. Knowledge of best practices for concurrent task execution is necessary for reliable system control. We’ll demonstrate how robust and powerful control programs are created using modern Python techniques.
11.1 Concurrency in Python
Concurrency in computing is a broad topic describing a scenario in which programs run essentially at the same time. There are multiple ways to achieve concurrency in computing.
The obvious way to run tasks concurrently is to run separate programs on separate CPUs (central processing units) or CPU cores. Whether distributing programs amongst multiple CPUs or multiple cores of a single CPU, using distinct processors to run each program is the only way to enable true concurrent execution, in its purest form. Python supports this style of concurrent execution using its multiprocessing module, which ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access