You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Introduction To Asynchronous Programming With Python
2
2
3
+
The slide deck for this presentation is accessible [here](docs/Intro-to-Async-Python.pdf).
4
+
3
5
This repository contains the code examples that go along with the
4
6
Google slide deck for the presentation. The examples progress one after
5
7
the other from a simple synchronous app that just runs a time delayed
@@ -8,7 +10,7 @@ to get web pages concurrently.
8
10
9
11
## Installation
10
12
11
-
It's recommended to use a Python virtual environment to install the
13
+
It's recommended to use a Python virtual environment to install the
12
14
necessary modules and run the example programs. I use [pyenv](https://github.com/pyenv/pyenv) to make a version of Python available in the project directory. The examples were built using Python version 3.9.5.
13
15
14
16
Here's the commands using pyenv to get the examples running in Mac or Linux:
* example_1.py - This program demonstrates a synchronous approach
27
-
to accomplishing tasks. The worker can't delegate
28
-
any tasks and completes them all one after another.
29
-
* example_2.py - This program demonstrates a synchronous approach
30
-
to accomplishing tasks. The worker can't delegate
31
-
any tasks and completes them all one after another.
32
-
In this version there is a second worker created,
33
-
but the two workers aren't cooperating with each
34
-
other.
35
-
* example_3.py - This program demonstrates a synchronous approach
36
-
to accomplishing tasks. In this version there is a
37
-
second worker created, and the workers can delegate
38
-
back to the control loop to cooperate with each other,
39
-
but there isn't any net benefit because the tasks
40
-
are still running synchronously.
41
-
* example_4.py - This program demonstrates a asynchronous approach
42
-
to accomplishing tasks. In this version there is a
43
-
second worker created, and the workers can delegate
44
-
back to the control loop to cooperate with each other.
45
-
In this version the tasks are asynchronous, so the
46
-
workers run concurrently.
47
-
* example_5.py - This program demonstrates a synchronous approach
48
-
to accomplishing tasks. In this version there is a
49
-
second worker created, and the workers can delegate
50
-
back to the control loop to cooperate with each other,
51
-
but there isn't any net benefit because the tasks
52
-
are still running synchronously. The tasks for this demo are getting the contents of webpages.
53
-
* example_6.py - This program demonstrates a asynchronous approach
54
-
to accomplishing tasks. In this version there is a
55
-
second worker created, and the workers can delegate
56
-
back to the control loop to cooperate with each other.
57
-
In this version the tasks are asynchronous, so the
58
-
workers run concurrently. The tasks for this demo are getting the contents of webpages.
59
-
* example_7.py - This is a bonus example program demonstrating a asynchronous approach to accomplishing tasks. In this version there is a second worker created, and the workers can delegate
60
-
back to the control loop to cooperate with each other.
61
-
In this version the tasks are asynchronous, so the
62
-
workers run concurrently. The tasks for this demo are getting the contents of webpages and reading files
28
+
- example_1.py - This program demonstrates a synchronous approach
29
+
to accomplishing tasks. The worker can't delegate
30
+
any tasks and completes them all one after another.
31
+
- example_2.py - This program demonstrates a synchronous approach
32
+
to accomplishing tasks. The worker can't delegate
33
+
any tasks and completes them all one after another.
34
+
In this version there is a second worker created,
35
+
but the two workers aren't cooperating with each
36
+
other.
37
+
- example_3.py - This program demonstrates a synchronous approach
38
+
to accomplishing tasks. In this version there is a
39
+
second worker created, and the workers can delegate
40
+
back to the control loop to cooperate with each other,
41
+
but there isn't any net benefit because the tasks
42
+
are still running synchronously.
43
+
- example_4.py - This program demonstrates a asynchronous approach
44
+
to accomplishing tasks. In this version there is a
45
+
second worker created, and the workers can delegate
46
+
back to the control loop to cooperate with each other.
47
+
In this version the tasks are asynchronous, so the
48
+
workers run concurrently.
49
+
- example_5.py - This program demonstrates a synchronous approach
50
+
to accomplishing tasks. In this version there is a
51
+
second worker created, and the workers can delegate
52
+
back to the control loop to cooperate with each other,
53
+
but there isn't any net benefit because the tasks
54
+
are still running synchronously. The tasks for this demo are getting the contents of webpages.
55
+
- example_6.py - This program demonstrates a asynchronous approach
56
+
to accomplishing tasks. In this version there is a
57
+
second worker created, and the workers can delegate
58
+
back to the control loop to cooperate with each other.
59
+
In this version the tasks are asynchronous, so the
60
+
workers run concurrently. The tasks for this demo are getting the contents of webpages.
61
+
- example_7.py - This is a bonus example program demonstrating a asynchronous approach to accomplishing tasks. In this version there is a second worker created, and the workers can delegate
62
+
back to the control loop to cooperate with each other.
63
+
In this version the tasks are asynchronous, so the
64
+
workers run concurrently. The tasks for this demo are getting the contents of webpages and reading files
0 commit comments