From 6902d2dffc04b57e7a49f308139b27775a2193fa Mon Sep 17 00:00:00 2001 From: Han Xiao Date: Mon, 20 Jun 2022 17:58:12 +0200 Subject: [PATCH] feat: read config from stdin to allow pipe (#758) --- server/clip_server/__main__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/clip_server/__main__.py b/server/clip_server/__main__.py index 41ccfd2c2..e844ee1fb 100644 --- a/server/clip_server/__main__.py +++ b/server/clip_server/__main__.py @@ -10,8 +10,16 @@ from jina import Flow + if len(sys.argv) > 1: + if sys.argv[1] == '-i': + _input = sys.stdin.read() + else: + _input = sys.argv[1] + else: + _input = 'torch-flow.yml' + f = Flow.load_config( - 'torch-flow.yml' if len(sys.argv) == 1 else sys.argv[1], + _input, extra_search_paths=[os.path.dirname(inspect.getfile(inspect.currentframe()))], ) with f: