Skip to content

Commit a0ebce7

Browse files
committed
add arch code
0 parents  commit a0ebce7

File tree

19 files changed

+145
-0
lines changed

19 files changed

+145
-0
lines changed

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include AUTHORS
2+
include ChangeLog
3+
exclude .gitignore
4+
exclude .gitreview
5+
6+
global-exclude *.pyc
7+
#recursive-include public *

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#just study project
2+
3+

bigbang/__init__.py

Whitespace-only changes.

bigbang/api/__init__.py

Whitespace-only changes.

bigbang/api/app.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from oslo_service import service
2+
3+
_launcher = None
4+
5+
def setup():
6+
pass
7+
8+
def serve(api_service, conf, workers):
9+
global _launcher
10+
if not _launcher:
11+
raise
12+
pass
13+
14+
_launcher = service.launch(conf, api_service, workers=workers)
15+
16+
17+
def wait():
18+
_launcher.wait()

bigbang/api/config.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sys
2+
from oslo_config import cfg
3+
from oslo_log import log as logging
4+
5+
LOG = logging.getLogger(__name__)
6+
7+
api_opts = [
8+
cfg.Stropt('bind_host', default='0.0.0.0',
9+
help=("api server ip")),
10+
cfg.IntOpt('bind_port', default='8080',
11+
help=("port")),
12+
cfg.Intopt('api_workers', default=2,
13+
help=("the number of workers"))
14+
]
15+
16+
17+
def init(args, **kwargs):
18+
api_config_group = cfg.OptGroup(name='api', title='bigbang api options')
19+
cfg.CONF.register_group(api_config_group)
20+
cfg.CONF.register_opts(api_opts, group=api_config_group)
21+
logging.register_options(cfg.CONF)
22+
23+
cfg.CONF(args=args, project='bigbang', **kwargs)
24+
25+
26+
def setup_logging():
27+
product_name = 'bigbang'
28+
logging.setup(cfg.CONF, product_name)
29+
logging.info('logging enable!')
30+
logging.debug('command line %s', " ".join(sys.argv))

bigbang/api/controller/v1/__init__.py

Whitespace-only changes.

bigbang/cmd/__init__.py

Whitespace-only changes.

bigbang/cmd/api.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import sys
2+
3+
from oslo_config import cfg
4+
from oslo_log import log as logging
5+
6+
from oslo_service import wsgi
7+
from bigbang.api import app
8+
from bigbang.api import config as api_config
9+
10+
CONF = cfg.CONF
11+
LOG = logging.getLogger('bigbang.api')
12+
13+
14+
def main():
15+
api_config.init(sys.argv[1:])
16+
api_config.setup_logging()
17+
host = CONF.api.bind_host
18+
port = CONF.api.bind_port
19+
workers = CONF.api.workers
20+
application = app.setup()
21+
22+
service = wsgi.service(CONF, 'bigbang', application, host, ip)
23+
app.serve(service, CONF, workers)
24+
25+
app.wait()

bigbang/cmd/controller.py

Whitespace-only changes.

0 commit comments

Comments
 (0)