-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·59 lines (50 loc) · 1.42 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import argparse
import uvicorn
#class App:
# ...
#app = App()
parser = argparse.ArgumentParser(description='Start BL lookup server.')
parser.add_argument('--host', default='0.0.0.0', type=str)
parser.add_argument('--port', default=8144, type=int)
parser.add_argument('--model', type=str)
try:
args = parser.parse_args()
except:
args = {}
if __name__ == "__main__":
uvicorn.run("bl_lookup.server:APP", host=args.host, port=args.port, log_level="info")
#!/usr/bin/env python
#"""Run BL server."""
import argparse
#from bl_lookup.server import app
#from bl_lookup.bl import get_models, generate_bl_map
#import json
#import pathlib
#data = dict()
#uri_maps = dict()
#
#@app.listener("before_server_start")
#async def load_userdata(app, loop):
# if args.model is not None:
# data[args.model], uri_maps[args.model] = generate_bl_map(version=args.model)
# else:
# models = get_models()
# for version in models:
# data[version], uri_maps[version] = generate_bl_map(version=version)
#
# pmapfile = pathlib.Path(__file__).parent.resolve().joinpath('resources/predicate_map.json')
# with open(pmapfile,'r') as inmap:
# pmap = json.load(inmap)
#
# app.ctx.userdata = {
# 'data': data,
# 'uri_maps': uri_maps,
# 'qualifier_map': pmap
# }
#
#if __name__ == '__main__':
# app.run(
# host=args.host,
# port=args.port,
# debug=True,
# )