-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e24348
commit 8ebd8ae
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
bind = "127.0.0.1:8000" | ||
reload = True | ||
timeout = 30 | ||
errorlog = "-" | ||
loglevel = "info" | ||
wsgi_app = "bfportal.wsgi:application" | ||
|
||
|
||
def when_ready(server): | ||
"""Called just after the master process is initialized.""" | ||
server.log.info("Server is ready. Spawning workers") | ||
|
||
|
||
def worker_int(worker): | ||
"""Called when a worker receives the INT or QUIT signal.""" | ||
worker.log.info("worker received INT or QUIT signal") | ||
|
||
# get traceback info | ||
import sys | ||
import threading | ||
import traceback | ||
|
||
id2name = {th.ident: th.name for th in threading.enumerate()} | ||
code = [] | ||
for threadId, stack in sys._current_frames().items(): | ||
code.append("\n# Thread: %s(%d)" % (id2name.get(threadId, ""), threadId)) | ||
for filename, lineno, name, line in traceback.extract_stack(stack): | ||
code.append('File: "%s", line %d, in %s' % (filename, lineno, name)) | ||
if line: | ||
code.append(" %s" % (line.strip())) | ||
worker.log.debug("\n".join(code)) | ||
|
||
|
||
def worker_abort(worker): | ||
"""Called when a worker receives the SIGABRT signal.""" | ||
worker.log.info("worker received SIGABRT signal") | ||
|
||
|
||
print("Gunicorn config loaded") |