Skip to content
Permalink
Browse files

feat(service): enabling the choose of thread or process as the backend

  • Loading branch information...
hanxiao committed Aug 7, 2019
1 parent 220b5a5 commit 63f9173f3ecbd6d2e4836fa7b1d01736f854c002
Showing with 17 additions and 17 deletions.
  1. +16 −16 gnes/cli/api.py
  2. +1 −1 gnes/service/base.py
@@ -16,6 +16,12 @@
# pylint: disable=low-comment-ratio


def preprocess(args):
from ..service.preprocessor import PreprocessorService
with PreprocessorService(args) as es:
es.join()


def encode(args):
from ..service.encoder import EncoderService
with EncoderService(args) as es:
@@ -34,16 +40,6 @@ def route(args):
es.join()


def compose(args):
from ..composer.base import YamlComposer
from ..composer.flask import YamlComposerFlask

if args.flask:
YamlComposerFlask(args).run()
else:
YamlComposer(args).build_all()


def frontend(args):
from ..service.grpc import GRPCFrontend
import threading
@@ -52,12 +48,6 @@ def frontend(args):
forever.wait()


def preprocess(args):
from ..service.preprocessor import PreprocessorService
with PreprocessorService(args) as es:
es.join()


def client_http(args):
from ..client.http import HttpClient
HttpClient(args).start()
@@ -66,3 +56,13 @@ def client_http(args):
def client_cli(args):
from ..client.cli import CLIClient
CLIClient(args)


def compose(args):
from ..composer.base import YamlComposer
from ..composer.flask import YamlComposerFlask

if args.flask:
YamlComposerFlask(args).run()
else:
YamlComposer(args).build_all()
@@ -170,7 +170,7 @@ def __call__(cls, *args, **kwargs):
}[args[0].concurrency_backend]

# rebuild the class according to mro
for c in cls.mro()[::-1][1:]:
for c in cls.mro()[-2::-1]:
arg_cls = ConcurrentService._dct[c.__name__]['cls']
arg_name = ConcurrentService._dct[c.__name__]['name']
arg_dct = ConcurrentService._dct[c.__name__]['dct']

0 comments on commit 63f9173

Please sign in to comment.
You can’t perform that action at this time.