Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
feat(service): enabling the choose of thread or process as the backend
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Aug 7, 2019
1 parent 220b5a5 commit 63f9173
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
32 changes: 16 additions & 16 deletions gnes/cli/api.py
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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()
Expand All @@ -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()
2 changes: 1 addition & 1 deletion gnes/service/base.py
Expand Up @@ -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']
Expand Down

0 comments on commit 63f9173

Please sign in to comment.