File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -45,7 +45,21 @@ ot_sources := $(ot_py_sources)
45
45
clean_cmd = $(SHX ) rm -rf build dist .coverage coverage.xml '*.egg-info' '**/__pycache__' '**/*.pyc' 'robot_server/**/.mypy_cache'
46
46
47
47
# Uvicorn command to run the robot server in dev mode.
48
- run_dev ?= uvicorn "robot_server:app" --host localhost --port 31950 --ws wsproto --reload
48
+ #
49
+ # "--lifespan on" ensures errors in startup and shutdown handlers won't be hidden.
50
+ # See github.com/encode/starlette/issues/1138, fixed in Starlette v0.16.0?
51
+ #
52
+ # todo(mm, 2021-07-08): Figure out how to run the server with Python development
53
+ # mode enabled, to expose more errors and warnings.
54
+ # * Using a Makefile target-specific variable to set PYTHONDEVMODE=1
55
+ # doesn't work because it applies the variable to the whole `pipenv run`
56
+ # command, and we only want our inner server process running under dev mode,
57
+ # not the outer pipenv process.
58
+ # * Adding PYTHONDEVMODE=1 to the .env file specified by
59
+ # OT_ROBOT_SERVER_DOT_ENV_PATH doesn't work because that's read too late.
60
+ # * Doing `pipenv run env PYTHONDEVMODE=1 uvicorn ...` works, except it's
61
+ # probably POSIX-only.
62
+ run_dev ?= uvicorn "robot_server:app" --host localhost --port 31950 --ws wsproto --lifespan on --reload
49
63
50
64
.PHONY : all
51
65
all : clean wheel
Original file line number Diff line number Diff line change @@ -6,7 +6,9 @@ After=opentrons-status-leds.service
6
6
7
7
[Service]
8
8
Type =notify
9
- ExecStart =uvicorn robot_server:app --uds /run/aiohttp.sock --ws wsproto
9
+ # "--lifespan on" ensures errors in startup and shutdown handlers won't be hidden.
10
+ # See github.com/encode/starlette/issues/1138, fixed in Starlette v0.16.0?
11
+ ExecStart =uvicorn robot_server:app --uds /run/aiohttp.sock --ws wsproto --lifespan on
10
12
# Stop the button blinking
11
13
ExecStartPost =systemctl stop opentrons-gpio-setup.service
12
14
Environment =OT_SMOOTHIE_ID =AMA RUNNING_ON_PI =true
You can’t perform that action at this time.
0 commit comments