This a simple fix to the unbearable default solution of google-cloud-sdk for the autoreload function of the dev_appserver
.
Indeed google decided to default to a pooling thread that consistently uses tons of CPU to check if the files of the project have been edited.
So, to fix that, you just need to use this simple script, that will replace the default file_watcher implementation of the SDK, and replace it by a way more simpler version based on watchdog. The latest version of watchdog will be added to the google cloud dependencies, so no need to add it to you environment.
As simple as:
python fix_watcher.py
By default, it will assume that the sdk is installed at
/home/user/google-cloud-sdk
Here all this too can do:
foo@bar:~$ python fix_watcher -h
usage: fix_watcher.py [-h] [-t PATH] [--uninstall] [-f PATH]
Will install watchdog into local google-appengine-sdk and use it to improve
performances
optional arguments:
-h, --help show this help message and exit
-t PATH, --to PATH PATH to the google cloud SDK
--uninstall removes watchdog and restores files to original state
-f PATH, --from PATH PATH to the google cloud SDK to uninstall. By default
will reuse PATH from last install
GOOGLE_SDK_PATH='/path/to/google-cloud-sdk'
python fix_wacther.py --target $GOOGLE_SDK_PATH
You can configure teh file watcher by adding these options in you Setup.cgf
[appengine:file_watcher]
watcher_extension=.js,.html,.css,.py
With each option being:
Option | Definition | Default Value |
---|---|---|
watcher_extension |
list of .ext separated by a , |
.go,.py,.yaml (see mtime_file_watcher) |