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
Copy file name to clipboardExpand all lines: examples/cloud_run_streaming_http/README.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,37 +3,49 @@
3
3
This sample shows how to deploy streaming functions to [Cloud Run](http://cloud.google.com/run) with the Functions Framework. The `main.py` file contains examples for both synchronous and asynchronous streaming.
4
4
5
5
## Dependencies
6
+
6
7
Install the dependencies for this example:
8
+
7
9
```sh
8
10
pip install -r requirements.txt
9
11
```
10
12
11
13
## Running locally
12
14
13
15
### Synchronous Streaming
16
+
14
17
To run the synchronous streaming function locally:
18
+
15
19
```sh
16
20
functions-framework --target=hello_stream
17
21
```
22
+
18
23
Then, send a request to it from another terminal:
24
+
19
25
```sh
20
26
curl localhost:8080
21
27
```
22
28
23
29
### Asynchronous Streaming
30
+
24
31
To run the asynchronous streaming function locally:
32
+
25
33
```sh
26
34
functions-framework --target=hello_stream_async
27
35
```
36
+
28
37
Then, send a request to it from another terminal:
38
+
29
39
```sh
30
40
curl localhost:8080
31
41
```
32
42
33
43
## Deploying to Cloud Run
44
+
34
45
You can deploy these functions to Cloud Run using the `gcloud` CLI.
35
46
36
47
### Synchronous Streaming
48
+
37
49
```sh
38
50
gcloud run deploy streaming-function \
39
51
--source . \
@@ -43,6 +55,7 @@ gcloud run deploy streaming-function \
43
55
```
44
56
45
57
### Asynchronous Streaming
58
+
46
59
```sh
47
60
gcloud run deploy streaming-async-function \
48
61
--source . \
@@ -51,4 +64,5 @@ gcloud run deploy streaming-async-function \
0 commit comments