8000 Adding comments and clarifications · mikeguzman/python-docs-samples@38dc894 · GitHub
[go: up one dir, main page]

Skip to content

Commit 38dc894

Browse files
committed
Adding comments and clarifications
1 parent 7a10585 commit 38dc894

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

run/system-package/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ _Note: you may need to install `pytest` using `pip install pytest`._
3232

3333
## Deploy
3434

35-
```
35+
```sh
3636
# Set an environment variable with your GCP Project ID
3737
export GOOGLE_CLOUD_PROJECT=<PROJECT_ID>
3838

run/system-package/main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@
1717
import subprocess
1818
import sys
1919

20+
2021
app = Flask(__name__)
2122

23+
2224
# [START run_system_package_handler]
2325
@app.route('/diagram.png', methods=['GET'])
2426
def index():
27+
# Uses the graphviz DOT language
28+
# https://www.graphviz.org/doc/info/lang.html
2529
try:
2630
image = create_diagram(request.args.get('dot'))
2731

@@ -35,6 +39,7 @@ def index():
3539
# Flush the stdout to avoid log buffering.
3640
sys.stdout.flush()
3741

42+
# If no graphviz definition or bad graphviz def, return 400
3843
if 'syntax' in str(e):
3944
return f'Bad Request: {e}', 400
4045

@@ -47,7 +52,8 @@ def create_diagram(dot):
4752
if not dot:
4853
raise Exception('syntax: no graphviz definition provided')
4954

50-
dot_args = ['/usr/bin/dot', # Command to run
55+
dot_args = [ # usr/bin/dot is a system package in the container
56+
'/usr/bin/dot', # Command to run
5157
'-Glabel=Made on Cloud Run', # Args
5258
'-Gfontsize=10',
5359
'-Glabeljust=right',

0 commit comments

Comments
 (0)
0