forked from mirrors/thatmattlove-hyperglass
clean up asgi initiator
This commit is contained in:
parent
bd00c0dba8
commit
6a485a225e
2 changed files with 11 additions and 21 deletions
|
|
@ -1,27 +1,17 @@
|
|||
"""
|
||||
Hyperglass web app initiator. Launches Sanic with appropriate number of
|
||||
workers per their documentation (equal to number of CPU cores).
|
||||
"""
|
||||
try:
|
||||
import os
|
||||
import tempfile
|
||||
from hyperglass import hyperglass, APP_PARAMS
|
||||
except ImportError as import_error:
|
||||
raise RuntimeError(import_error)
|
||||
"""hyperglass web app initiator."""
|
||||
|
||||
|
||||
def start():
|
||||
"""
|
||||
Compiles configured Sass variables to CSS, then starts Sanic web
|
||||
server.
|
||||
"""
|
||||
tempdir = tempfile.TemporaryDirectory(prefix="hyperglass_")
|
||||
os.environ["prometheus_multiproc_dir"] = tempdir.name
|
||||
|
||||
"""Start Sanic web server."""
|
||||
try:
|
||||
from hyperglass import hyperglass, APP_PARAMS
|
||||
|
||||
hyperglass.app.run(**APP_PARAMS)
|
||||
except Exception as hyperglass_error:
|
||||
raise RuntimeError(hyperglass_error)
|
||||
|
||||
except ImportError as import_err:
|
||||
raise RuntimeError(str(import_err))
|
||||
except Exception as web_err:
|
||||
raise RuntimeError(str(web_err))
|
||||
|
||||
|
||||
app = start()
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<text x="45.0" y="14">Lines of Code</text>
|
||||
</g>
|
||||
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
|
||||
<text x="106.0" y="15" fill="#010101" fill-opacity=".3">3202</text>
|
||||
<text x="105.0" y="14">3202</text>
|
||||
<text x="106.0" y="15" fill="#010101" fill-opacity=".3">3191</text>
|
||||
<text x="105.0" y="14">3191</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1 KiB After Width: | Height: | Size: 1 KiB |
Loading…
Add table
Reference in a new issue